Hyperlink open in new tab
To make a hyperlink open in a new tab, you can add the following code to the link:
target="_blank"
Here's an example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Visit Example.com</a>
This will make the link open in a new tab when clicked.
Alternatively, you can also use the rel
attribute to specify that the link should open in a new tab:
<a rel="nofollow" target="_blank" href="https://www.example.com" rel="noopener noreferrer" target="_blank">Visit Example.com</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 page's cookies and other sensitive information.
You can also use JavaScript to achieve this. For example:
<a rel="nofollow" target="_blank" href="https://www.example.com" onclick="window.open(this.href, '_blank'); return false;">Visit Example.com</a>
This will also open the link in a new tab when clicked.
Note that the target
attribute is not supported in HTML5, so you may need to use the rel
attribute or JavaScript to achieve this effect.