SafeAlert

By serial_crusher Last update Jan 3, 2009 — Installed 202 times. Daily Installs: 0, 0, 0, 2, 0, 1, 0, 3, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 2, 1
Script Summary:
Prevents malicious scripts from calling "alert" infinitely and rendering your browser unusable.
Version: 1.0
Recently Updated TopicsPosts
Doesn't work all the time4

this script has 1 topic, 4 posts

This script has no reviews.

Ever get a link to one of those "hilarious" sites that shows like meatspin or lemon party or goatse and keeps popping up alert boxes so it's impossible to close the tab without killing Firefox? Yeah, those are soooo funny. Especially when you're at work.

This script overrides common functions alert(), confirm(), and prompt() and disables them in the event of a flood.

If a script calls any of the above 5 times within 5 seconds, you'll get a prompt to disable them or not, giving you ample time to close the window.

While I'm on my soapbox... why does Firefox even block the ENTIRE browser when one tab is alerting? I can see locking down the tab that called alert, but not letting me close the window (or the offending tab) is just asinine. I thought about an extension for Firefox that would replace alert with something tab-specific, but this was a way quicker fix. Maybe some day....

Update, 3/17/2009: Fair warning: it doesn't work if the malicious site starts alerting before GreaseMonkey has a chance to fire off the script, but can still help in some cases. Somebody with some actual Firefox extension know-how should make a version that runs early enough...

Update, 1/2/2009: Added prefs dialog. Configure timeout interval, number of alerts allowed per interval, and whitelist/blacklist for URLs. Thanks to Smiths, as I borrowed his template for the options dialog.
(go to Tools->Greasemonkey->User Script Commands->SafeAlert Options to access prefs)