Make a link open in new tab

To make a link 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">Open in new tab</a>

This will open the link in a new tab when clicked.

Alternatively, you can also use the rel attribute with the value noopener to prevent the new tab from being able to access the parent page:

<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank" rel="noopener">Open in new tab</a>

This is a good practice to prevent potential security vulnerabilities.

You can also use the target="_blank" attribute on an anchor tag inside a JavaScript code, for example:

document.getElementById("myLink").href = "https://www.example.com";
document.getElementById("myLink").target = "_blank";

This will also open the link in a new tab when clicked.