02 / 04

What is rel="noopener noreferrer" used for?

Understanding rel="noopener noreferrer" in HTML

The rel="noopener noreferrer" attribute is used in HTML anchor (<a>) tags to improve security and privacy when opening links in a new tab or window using target="_blank".

Why Use rel="noopener noreferrer"
  1. 1

    noopener: Prevents the new tab from accessing the window.opener property, which protects your page from malicious scripts that could manipulate it.

  2. 2

    noreferrer: Prevents the browser from sending the Referer header to the new page, which hides the URL of the original page and adds privacy.

  3. 3

    Combined: Using both ensures better protection against tabnabbing (phishing attacks) and reduces information leakage.

Example Usage

In short: Always use rel="noopener noreferrer" when linking to external sites with target="_blank" to protect users from security risks like tabnabbing and to improve privacy.