DEV Community

Why should you use "noopener"? Beware of security Flaws.

Dhilip kumar on August 17, 2019

TLDR: Checkout the implementation example here: Live Demo Let's Open a url in new tab from within our website HTML WAY &l...
Collapse
 
chillsunfire profile image
Sunfire

I've been using noopener and noreferrer for years now, but never really understanding why. Thank you for the understandable explanation.

Collapse
 
dhilipkmr profile image
Dhilip kumar • Edited

Yes missed them!

Whenever the opener object is defined in the new website, both run with same event loop. (i.e) there is only one process handling both tabs.

May be the approach of creating anchor tag dynamically through js and clicking it is the best approach that considers all cases ,if we want to open the new tab through JavaScript

Collapse
 
chrisachard profile image
Chris Achard

Thanks - I've seen the warning message to use noopener in gatsby before, but never knew why. Now I do!

Collapse
 
dhilipkmr profile image
Dhilip kumar

😃😃✌️✌️

Collapse
 
havarem profile image
André Jacques

Very good to know, I've never come across this before. Thanks a lot :)

Collapse
 
dhilipkmr profile image
Dhilip kumar

😃😃✌️

Collapse
 
marcellothearcane profile image
marcellothearcane

Weirdly, window.opener.open() is blocked by chrome (if it's cross-origin), but not window.opener.location = <url>