A href link that opens new tab
To create an HTML link that opens in a new tab, you can use the target
attribute and set its value to _blank
. Here's an example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Visit Example.com</a>
This will create a link that opens the URL https://www.example.com
in a new tab when clicked.
Note that you can also use target="_new"
or target="_noopener"
instead of _blank
, but _blank
is the most commonly used and supported option.
If you want to open the link in a new tab and also prevent the parent page from following the link, you can use target="_blank" rel="noopener noreferrer"
:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank" rel="noopener noreferrer">Visit Example.com</a>
This will open the link in a new tab and prevent the parent page from following the link, which can help prevent issues with page navigation and security.