Link to open in new tab
You can use the following HTML code to open a link in a new tab:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Link Text</a>
The target
attribute specifies that the link should be opened in a new tab or window. The value _blank
tells the browser to open the link in a new tab.
Alternatively, you can use the following code to open a link in a new tab using JavaScript:
<a rel="nofollow" target="_blank" href="https://www.example.com" onclick="window.open(this.href, '_blank'); return false;">Link Text</a>
This code uses the window.open
method to open the link in a new tab, and the return false
statement prevents the default link behavior from occurring.
You can also use the rel
attribute to specify that the link should be opened in a new tab:
<a rel="nofollow" target="_blank" href="https://www.example.com" rel="noopener noreferrer" target="_blank">Link Text</a>
The rel
attribute specifies the relationship between the current page and the linked page. The noopener noreferrer
value tells the browser to open the link in a new tab and prevent the linked page from accessing the current page's context.