Force New Tab When Link Is Tapped
When a new tab needs to open as a person taps a link, the target
attribute of an a
tag can be used. When target="_blank"
is in an a
tag, then tapping the link will open a new browser tab.
Example:
<a href="https://example.com" target="_blank">Tap here</a>
Instances where the target="_blank"
attribute may be appropriate are, as examples:
-
A download page with several download links, so the download page remains available.
-
A one-time-use web page where a link might be tapped before the page function is complete.
-
Web sites with a site visitor demographic that is unlikely to know about right-click or tap-and-hold to open links in new tabs.
When the target="_blank"
attribute is implemented, the site visitor is less likely to lose the page the link is on.
(This content first appeared in Possibilities newsletter.)
Will Bontrager