0

I am writing the below code in JavaScript and I am not able to check popup blocker is enabled or not in chrome

method 1:

var params = 'height=1,width=1,left=-100,top=-100,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,directories=no,status=no';
var testWindow = window.open(null, "popupTest", params);
if( !testWindow
    || testWindow.closed
    || (typeof testWindow.closed=='undefined')
    || testWindow.outerHeight == 0
    || testWindow.outerWidth == 0
    ) {
    // pop-ups ARE blocked
  //  document.location.href = 'popupsBlocked.htm';
    alert("blocked");
}
else {
    // pop-ups are NOT blocked
  testWindow.close();
    alert("not blocked");
}

method 2:

var test = window.open(null, "", "width=0,height=0");
    try {
        test.close();           
        alert("Pop-ups not blocked");
    } catch (e) {
        alert("Pop-up blocker is enabled in the browsers");
    }

both methods are not working pls help me....

Maroun
  • 94,125
  • 30
  • 188
  • 241
kumar
  • 708
  • 4
  • 15
  • 39

0 Answers0