A href target new tab
The a
tag with target
attribute set to _blank
opens the linked document in a new tab or window. Here's the syntax:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Link Text</a>
This will open the linked page in a new tab, leaving the current page intact.
Here are some additional options for the target
attribute:
_blank
: Opens the linked document in a new tab or window._self
: Opens the linked document in the same frame as the current page (default behavior)._parent
: Opens the linked document in the parent frame._top
: Opens the linked document in the full body of the window.framename
: Opens the linked document in a specific frame with the given name.
Note that the target
attribute only works for links that point to external resources (e.g., other websites, files, etc.). If you try to use it with an internal link (e.g., a link to another page on the same website), it will not work as expected.
Also, keep in mind that some browsers may have settings or extensions that can override the target
attribute, so it's always a good idea to test your links in different browsers and environments to ensure they work as expected.