Categories
Development

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;
}