There are many sites on the internet that recommend you to add the noopener noreferrer attributes to your link as a safety measure. This is to avoid malicious scripts from other domains to take control of your window (for a link with target="_blank").

There's even an eslint rule to make sure of that:




I get the noopener part. It makes sense. But do I really need the noreferrer to be safe?


You only need to use one or the other. From Google tools for web developers -- Links to cross-origin destinations are unsafe:

  • rel="noopener" prevents the new page from being able to access the window.opener property and ensures it runs in a separate process.
  • rel="noreferrer" attribute has the same effect, but also prevents the Referer header from being sent to the new page.

So there is no need to use both of them. Either of them will prevent the security problem on its own.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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