简体   繁体   English

以编程方式确定是否在浏览器中启用了弹出窗口阻止程序,而无需打开新选项卡

[英]programmatically determine if the popup blocker is enabled in a browser without opening the new tab

有没有什么方法可以确定是否通过JavaScript在浏览器中启用了弹出窗口阻止程序而无需打开新选项卡?

I don't think you can detect it without using window.open , so I think the short answer to your question is: No, there isn't. 我认为您不使用window.open无法检测到它,因此我认为对您的问题的简短回答是:不,没有。

The accepted answers to this question and this question demonstrate using window.open (the first then immediately closes the window). 问题该问题的可接受答案均使用window.open演示(第一个然后立即关闭窗口)。 However: If the popup is blocked, the user still receives the notification of a blocked popup (at least in Chrome, but probably others as well), which I'm guessing is why you've said you don't want to use window.open . 但是:如果弹出窗口被阻止,则用户仍然会收到被阻止的弹出窗口的通知(至少在Chrome中,但也可能在其他window.open ),我猜这就是为什么您说过不想使用window.open

So again, I think the answer to your question is: No, you can't do that. 再次,我认为您的问题的答案是:不,您不能这样做。

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

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