/ Published in: JavaScript
Expand |
Embed | Plain Text
/*<!-- Fri, 28 Jan 2011 20:42:25 GMT+0000 <a href="http://javascript.internet.com/snippets/alert-box-protection.html">The JavaScript Source: Snippets : Alert Box Protection</a>-->*/ /*<!-- Add this snippet to the beginning of your code for testing purposes. --> This script and many more are available free online at The JavaScript Source :: http://javascript.internet.com Created by: Benjamin Joffe :: http://www.abrahamjoffe.com.au/ */ (function(){ var a=window.alert, c=0; window.alert=function(q){ /*Change the number below to the number of alert boxes to display before the warning is given.*/ if(++c%5==0){ if(!confirm(/*q+*/'*** There have been '+c+' alert boxes, continue displaying them?')){ window.alert=function(){}; confirm('Reload this page?')? location.reload() : ''; }}else a(q);};})(); for(var i=1;i<50;i++) alert('*** This is an annoying loop of 50 alerts. Every 5th alert you will have an option to exit.\n\n'+i)
You need to login to post a comment.
