简体   繁体   English

Window Open 在 Userscript 中不起作用(使用 Violentmonkey)

[英]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它不会使用链接打开新的 window,脚本会继续

It works in the browser console though.它虽然在浏览器控制台中工作。

This works in the browser console though.虽然这在浏览器控制台中有效。 Why is this?为什么是这样?

Just like @justinw had said, after allowing popups everything works perfectly.就像@justinw 所说的那样,在允许弹出窗口后一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM