How do I detect popup blocker in Chrome? How do I detect popup blocker in Chrome? google-chrome google-chrome

How do I detect popup blocker in Chrome?


Finally, it success by combining different answer from Stackoverflow's member
This code worked for me & tested in 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);


Try Below..!!

var pop = window.open("about:blank", "new_window_123", "height=150,width=150");// Detect pop blockersetTimeout(function() {if(!pop || pop.closed || pop.closed == "undefined" || pop == "undefined" || parseInt(pop.innerWidth) == 0 || pop.document.documentElement.clientWidth != 150 || pop.document.documentElement.clientHeight != 150){pop && pop.close();alert("Popups must be enabled.");}else{alert("Popups is enabled.");pop && pop.close();}}, 1000);

Look on below question

Detect blocked popup in Chrome

How do I detect whether popups are blocked in chrome

On Google It will more help you..

https://www.google.com/search?q=how+to+detect+a+blocked+popup+in+chrome


I found it much more effective to use try-catch as follows:

var popup = window.open(winPath,winName,winFeature,true);try {    popup.focus();} catch (e) {    alert('popup blocked!');}