Html code for open in new tab
To open a link in a new tab, you can add the target
attribute to the a
tag and set its value to _blank
. Here is the HTML code:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Open in new tab</a>
This will open the link in a new tab when the user clicks on it.
You can also use the rel
attribute to specify that the link should be opened in a new tab. The value noopener
is recommended to prevent the new tab from accessing the parent page's cookies and other data.
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank" rel="noopener">Open in new tab</a>
Note that the target
attribute can also be set to _self
to open the link in the same tab, or _parent
to open it in the parent frame (if the page is framed).