Preventing access to `Window.opener`
When you open a link in a new tab with target="_blank"
like so:
<a target="_blank" href="http://some.link">Somewhere</a>
Then the page that you open has access to the original page through Window.opener
. Depending on your case you may not want this. Actually I can't think of a case where you do want the new tab to refer back to the opening tab.
To prevent Window.opener
access use rel="noopener"
:
<a target="_blank" href="http://some.link" rel="noopener">Somelink</a>
At this moment, this is not available in IE or Edge, check out the caniuse site.
H/T Dillon Hafer
Tweet