Preventing infinite alert loops in Javascript

On April 9, 2008, in Development, by Chris Carey

I found this code snippet which overrides the window.alert function to prevent an infinite loop.


window.alert = function(s) {
if(!confirm(s))
window.alert = null;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>