Safe alert

  • Published: 2005-11-15 00:11
  • Modified: 2005-11-15 00:16
  • Author: TarquinWJ
  • Requires: Opera 8.0
  • Install as: Opera User JS

Learn how to install scripts

Report a bug

Replaces JavaScript dialogs (alert, confirm, and prompt) with a confirm dialog, allowing you to choose if it should be allowed to open any more. Useful for detecting infinite dialog loops (usually self inflicted by mistake during testing).

Once you have added this User JavaScript, you can also use this bookmarklet to enable or disable JavaScript dialogs: Enable Dialogs (note that this will have no effect if the page is already locked in an infinite loop).

Since version 2.0, the following options are available:

  • Individually block each type of dialog
  • Say what should happen when a dialog is blocked (should the script abort, or should it continue, and what value should the blocked dialog return)
  • Say if you should be able to re-enable dialogs
  • Specify how many confirm or prompt dialogs should be allowed before asking if you want to allow more (alerts will check every time)
  • Provide site-specific overrides for any option


  • v 2.0: Major update. Script now blocks all JavaScript dialog types, and has loads more options (note that the bookmarklet format has also changed, so if you use it, you will need to get a copy of the new one).