javascript - How do I detect popup blocker in Chrome? -
i have searched many issue in stack overflow , might duplicate here detect popup
but not helped me while testing in chrome (tested v26.0.1410.64)
following approach worked in ie , firefox not in chrome
var popup = window.open(winpath,winname,winfeature,true); if (!popup || popup.closed || typeof popup.closed=='undefined'){ //worked ie , firefox alert("popup blocker enabled! please add site exception list."); window.location.href = 'warning.html'; } else { //popup allowed window.open('','_self'); window.close(); } any better solution works chrome also?
finally, success combining different answer stackoverflow's member
code worked 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 ie & firefox //second checking condition works chrome alert("popup blocker enabled! please add site exception list."); window.location.href = 'warning.html'; } else { //popup blocker disabled window.open('','_self'); window.close(); } }, 25);
Comments
Post a Comment