Weird Thoughts From Eric's Head

Tags - Categories : All | AJAX | BUSINESS | PERSONAL | PROGRAMMING | BOOK REVIEW


How are they defeating Pop Up Blockers?
People have been telling me that it seems like people are getting around pop up blockers. I sat down and tried to break the pop up blocker on google's toolbar on IE6. The first solution I already new, the second one I found in 1 minute.

Piggy Backing
The first solution is what I call piggy backing. Basically you just add an onclick handler on every link.

<a href="http://radio.javaranch.com/pascarello" onclick="window.open
('http://www.javaranch.com')">Your Link</a>


Overloading
The second solution I call is overloading. Basically making a loop that slams a window.open function. Well with google's toolbar, it you do not perform any actions on the page it blocksthem all, but if you start typing, for some reason the pop up blocker fails.
<script type="text/javascript">
  var winPop;
  var i=0;
  function BrakePopUp(){
    winPop = window.open("about:blank");
    document.title = i++;
    if (winPop==null || typeof(winPop)=="undefined")setTimeout("BrakePopUp()",10);
    else {}
  }
  window.onload=BrakePopUp
</script>


How did Mozilla fare?
Of course the piggy backing pop up got through. Not a surprise. The overloading popup did nothing but sit there. I let it run for over 30,000 pop up attempts. That is good.

So I though how about really slamming it, so I built the loop that made a killer loop that would freeze the browser with so many slams.
<script type="text/javascript">
  var winPop;
  var i=0;
  var time;
  function BrakePopUp(){
    winPop = window.open("about:blank");
    document.title = i++;
    if (winPop==null || typeof(winPop)=="undefined")time = setInterval("BrakePopUp()",10);
  }
  window.onload=BrakePopUp
</script>

Well IE cracked and froze, Mozilla just froze!

At some point I want to test this against SP2's pop up blocker.

Eric Pascarello
Moderator of HTML/JavaScript at www.JavaRanch.com
Author of: JavaScript: Your Visual Blueprint for Dynamic Web Pages




Add a comment

Title
Body
HTML : b, i, blockquote, br, p, pre, a href="", ul, ol, li
Math Quiz 6 + 5 = (Helps stop blog spam)
Name
E-mail address
Website
Remember me Yes  No 

E-mail addresses are not publicly displayed, so please only leave your e-mail address if you would like to be notified when new comments are added to this blog entry (you can opt-out later).

TrackBack to http://radio.javaranch.com/pascarello/addTrackBack.action?entry=1116946280225