DEV Community

How to redirect to URL in new tab On window load event๐ŸŠ

Top comments (2)

Collapse
 
hozefaj profile image
Hozefa • Edited

Making sure when cross linking to another site for security reasons its better to add rel="noopener" or rel="noreferrer" would be good.

In this example, it can be like

var windowFeatures = "rel='noopener noreferrer'";

window.open("https://atulprajapati.in", '_blank', windowFeatures)

reference docs:

  1. developer.mozilla.org/en-US/docs/W...
  2. web.dev/external-anchors-use-rel-n...
Collapse
 
atulcodex profile image
๐Ÿšฉ Atul Prajapati ๐Ÿ‡ฎ๐Ÿ‡ณ

Thanks ๐Ÿ’ brother, it's something new for me ๐Ÿ˜