Preventing infinite alert loops in Javascript

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 *