I remember back in the old days (Netscape was king!) when learning JavaScript that it was pretty easy to lock up the browser with the Alert statement. All you had to do was create an infinite loop of JavaScript alerts and then the browser was essentially locked up.
So while this typically only happens to poor developers who do it to themselves (as I did a few days ago), why haven't the browser makers done anything about this? Is it really something that only affects us doing development? While I'm not quite sure what the UI would be - it seems like something that could be solved. Perhaps the browser could simply keep an internal counter of the number of alerts fired. Once it hits 30, simply put a prompt on the alert asking if the user would like to suppress all future alerts.


Comment 1 written by Kyle Hayes on 7 January 2007, at 12:27 PM
Comment 2 written by John Dowdell on 7 January 2007, at 5:44 PM
Comment 3 written by Brian on 7 January 2007, at 7:48 PM
Comment 4 written by Raymond Camden on 7 January 2007, at 9:32 PM
Comment 5 written by Raymond Camden on 7 January 2007, at 9:34 PM
Comment 6 written by PaulC on 8 January 2007, at 8:48 AM
Maybe it pops open a toolbar at the top of the page along the lines of IE's "blocked content" message and Firefox's "install plug-in"...just more noticeable.
You could then have optional "traditional" alerts for times when you want to prevent the user from accessing the browser until they confirm. Such as: alert("message","strict") or alert("message","soft")
Comment 7 written by David L. Burkhart on 14 February 2008, at 2:49 PM
There has got to be some sort of shortcut way to cancel a script from within a series of alert messages.
Comment 8 written by Arnauld Chevallier on 18 November 2008, at 11:25 AM
just press and hold Ctrl+F4 on the keyboard, then use the mouse to click the "OK" button of the modal box. A last alert() may be fired, but the current tab should be closed.
(Note that it was only tested on FireFox 3.)
[Add Comment] [Subscribe to Comments]