[英]pop up alert triggers when blocked and allowed
I have this code to trigger a alert if some one blocks pop ups from my site: 如果从我的站点弹出一些阻止,我有以下代码可以触发警报:
var w = window.open( "url","_blank", "height = 200, width = 300, top=450, left=1025" );
if(w == null || typeof(w) == "undefined" || w.location.href == 'about:blank') {
alert("Please enabled popups for this site to continue.");
}
Problem is that the alert shows if i block or allow pop ups. 问题是警报显示我是否阻止或允许弹出窗口。 Why does it keep getting triggered? 为什么会不断被触发?
Many thanks 非常感谢
Instead of a pop up window I would recommend using a javascript modal pop up instead. 我建议您使用javascript模态弹出窗口代替弹出窗口。 Modal pop up windows will not be blocked and are not as intrusive as a pop up window. 模态弹出窗口将不会被阻止,并且不会像弹出窗口那样具有侵入性。
Here is a demo: 这是一个演示:
Outside HTML (Ajax)
would be the best example for you. Outside HTML (Ajax)
将是您的最佳示例。 Have a look at the source code to see how to call this if this is what you want. 查看源代码,以了解如何在需要时调用它。 There are many options for this. 有很多选择。 Here are a couple jquery options: 这是几个jquery选项:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.