Popup blocker detection in Google Chrome using Javascript


Hey guys,

If you all are looking for popup blocker detection in Google Crome then use this code, This code will work on all Google Crome versions. I have tested in 4.0.2 and above versions.


function IsPopupsAllowed()
{
var w = window.open('blank.htm','popup',"width=1,height=1,toolbar=no, top=3000px,left=3000,menubar=no,scrollbars=no,resizable=0");
var mybrsAgent=navigator.userAgent.toLowerCase();
if (w)
{     
if ((mybrsAgent.search(/chrome\//) !=-1) )
            {                                
            w.onload = function(){
            setTimeout(function(){
                    if (w.screenX === 0) {
                        returnCromeValue(false);
                    } else {
                        w.close();
                        returnCromeValue(true);
                    }
                }, 0);
            };
            }
      }   
 }

var allowed = "Blocked";
function returnCromeValue(arg)
{
if(arg==true)
{
      allowed = "Allowed";
      }
else
{
      allowed = "Blocked";
      }
alert(allowed);   
return allowed;
}

For more reference refer this url : 

Comments

Anonymous said…
THank yoU!

Popular posts from this blog

PDF form validation using javascript

How to delete xml node using php

Unable to Start Debugging on the Web Server