Open Anchor Link in New Tab

Open Anchor Link in New Tab

If you include links on your site, you probably want those to open up in a different tab so that users don't completely leave your site. This is certainly true for me site. Recently, i've had to look this up so many times, that I'm finally creating the post.

Here's a basic anchor tag.

<a href="">My Site</a>

By default this will redirect the user away from your site and stay within the same tab. To open in new tab we add a few small properties.

<a href="" rel="noopener noreferrer" target="_blank">Twitter</a>

That's it. Now, you're links should open up in a new tab!!