如何在Chrome中检测弹出窗口拦截器?

Sur*_*ali 15 javascript jquery google-chrome popup-blocker

我在堆栈溢出中搜索了很多问题,可能在这里 重复检测Popup

not helped for me同时,在测试中(测试v26.0.1410.64)
下面的方法Worked in IE and Firefox,但not in Chrome

var popup = window.open(winPath,winName,winFeature,true);
 if (!popup || popup.closed || typeof popup.closed=='undefined'){
       //Worked For IE and Firefox
        alert("Popup Blocker is enabled! Please add this site to your exception list.");
        window.location.href = 'warning.html';
 } else {
        //Popup Allowed
        window.open('','_self');
        window.close();
} 
Run Code Online (Sandbox Code Playgroud)

任何适用于Chrome的更好的解决方案呢?

Sur*_*ali 19

最后,它通过结合Stackoverflow成员的不同答案获得成功.
此代码适用于我并在其中进行测试IE, Chrome & Firefox

var popup = window.open(winPath,winName,winFeature,true);
 setTimeout( function() {
    if(!popup || popup.outerHeight === 0) {
        //First Checking Condition Works For IE & Firefox
        //Second Checking Condition Works For Chrome
        alert("Popup Blocker is enabled! Please add this site to your exception list.");
         window.location.href = 'warning.html';
    } else {
        //Popup Blocker Is Disabled
        window.open('','_self');
        window.close();
    } 
}, 25);
Run Code Online (Sandbox Code Playgroud)