Html code to open link in new tab
To open a link in a new tab, you can use the target
attribute in the a
tag and set its value to _blank
. Here is an example:
<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 link is clicked.
You can also use the rel
attribute to specify that the link should be opened in a new tab. Here is an example:
<a rel="nofollow" target="_blank" href="https://www.example.com" rel="noopener noreferrer" target="_blank">Open in new tab</a>
The rel
attribute is optional, but it's a good practice to include it to prevent the new tab from being able to access the parent window.
Note that the target
attribute can also be set to _self
to open the link in the same tab, _parent
to open the link in the parent frame, or _top
to open the link in the full body of the window.