9 months ago

Open links in new tab safely

Everyone knows that if you use target="_blank" on a link tag that link will be open in a new tab. But using just this is a security risk and could allow bad people to take control of your page by abusing the window.opener event - read more about it here

So if you need a link to open on a new tab, make sure you add rel="noopener noreferrer" to the tag as well.

So instead of using:

<a href="http://example.com" target="_blank">Link</a>

You should use: <a href="http://example.com" target="_blank" rel="noopener noreferrer">Link</a>

Do you have any comment on this tricks? then let the author know about that. comment here