PopUp Blocker code detection not working.

  • httpftp21
  • Graduate
  • Graduate
  • httpftp21
  • Posts: 101

Post 3+ Months Ago

I have turned on PopUp blocker in FF and Chrome.
I have a piece of code to check PopUp is working as:
Code: [ Select ]
function checkPopUp()
  var myTest = window.open("about:blank","","directories=no,height=1,width=1,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no");
  var popUpsBlocked = '';
  if (!myTest) {
    popUpsBlocked = true;    
  } else {
    popUpsBlocked = false;
  return popUpsBlocked;  
  1. function checkPopUp()
  2. {
  3.   var myTest = window.open("about:blank","","directories=no,height=1,width=1,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no");
  4.   var popUpsBlocked = '';
  5.   if (!myTest) {
  6.     popUpsBlocked = true;    
  7.   } else {
  8.     popUpsBlocked = false;
  9.   }
  10.   return popUpsBlocked;  
  11. }

its working fine "onload" of the page.
But when i am using it with hyper link onclick, its not working a popup is getting opened.
Code: [ Select ]
<a onclick="checkPopUp()" href="#">Test</a>

Any reason why? But same script will work i am testing it in AJAX response.
  • PaulR
  • Newbie
  • Newbie
  • PaulR
  • Posts: 5

Post 3+ Months Ago

I get the same results using your code httpftp21

I'm not 100% sure what the problem may be, but it may be the fact that you're trying to open a pop-up on the page load, which I can't seem to achieve, and I have tried a few methods using the onload.

I think the link with the function attached can excute the function correctly as the page has already loaded, I will delve abit deeper to find a solution, if one exists.

Yours, PaulR.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 33 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.