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
TrackBacks[0]
Comments[0]
Posted by pascarello on May 24, 2005 9:51:20 AM EST