Using rel="noopener" in window.open()

There is no direct example in doc but it can be used like this and it worked for me.

window.open('http://cats.com', '_blank', 'noopener,resizable,scrollbars')

Cover all your bases

The safest way to redirect is by adding noopener, noreferrer, and window.opener = null.

const openInNewTab = (url) => {
    const newWindow = window.open(url, '_blank', 'noopener,noreferrer')
    if (newWindow) newWindow.opener = null
}

Then call your new funtion

openInNewTab('https://stackoverflow.com')

The third param can also take these optional values, based on your needs.


This worked for me:

const a = document.createElement("a")
a.href = args.url
a.target = "_blank"
a.rel = "noopener"
a.click()