'Window Open doesn't work in Userscript (using Violentmonkey)

Here's a minimal reproducible example of what I'm talking about

OpenInBrowser = document.querySelectorAll('a[href*="https://WebsiteName/something"]')[0].getAttribute('href')
window.open(OpenInBrowser)

It doesn't open a new window with the link, the script just continues

It works in the browser console though.

This works in the browser console though. Why is this?



Solution 1:[1]

Just like @justinw had said, after allowing popups everything works perfectly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Que