问题解决了
首先,我为我糟糕的英语道歉。
我想检测客户端的浏览器是否阻止了弹出框。我搜索了许多网站并将许多答案整合为一个。我的实现如下:
var newWin =
window.open("abc.html", "",
"directories = no, height = 1000, width = 1000, menubar = no, resizable = no,
scrollbars = no, status = no, titlebar = no, top = 0, location = no");
// alert true if the blocker is enabled
setTimeout( function()
{
if (!newWin || newWin.closed ||
typeof newWin.closed == 'undefined' || newWin.outerHeight === 0)
alert("true");
else
{
alert("false");
}, 25);
但是,并非所有浏览器都会给出预期的响应。
只有 Firefox 22、Safari 5.1.7、Opera 12 给出了预期的响应。
Chrome 27 和 IE 10 没有给出预期的响应。
还有其他方法可以检测弹出窗口阻止程序吗?谢谢你。