12

I am learning about the merits of including rel="noopener noreferrer" for external links.

What is the difference between these two attribute values? When should I use noopener, and when should I use noreferrer?

1

1 Answer 1

19

rel="noopener" is used so that when a new window is created upon clicking a link, malicious javascript code running in the new window will not access your previous window via the window.opener attribute.

rel=noreferrer is used so that when a user clicks on a hyperlink and is transferred to a new location, no referrer information will be leaked to the destination link. Meaning, it will not be possible for the destination to know where that user came from.

You can find more information about both here and more about no referrer here

1
  • 2
    OK, I think I see what’s happening. The window is a reference to the actual browser window (or tab) parenting the link, while the referrer is a string with the URL of the parent document. The opener is the one likely to get you into trouble with malicious JavaScript code. According to WHATWG, noopener is implied in noreferer for historical reasons.
    – Manngo
    Commented Jul 2, 2018 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.