noopener and External Links

When opening external content in a new browsing context, developers should understand the security implications of target="_blank". The rel="noopener" relationship prevents the opened document from accessing the opener through window.opener.

Safer New-Tab Link
<a href="https://example.com" target="_blank" rel="noopener">\n  Open Example\n</a>

noopener prevents the newly opened page from using the opener reference to interact with the original page.

Key Takeaways
  • Understand opener relationships when opening new browsing contexts.

  • Use appropriate rel values for external links.

Knowledge Check

What does rel="noopener" primarily prevent?