JavaScript: slow script warning

JavaScript FAQ | JavaScript Dialogs FAQ  

Question: Why does the browser display the slow script warning?

Answer: If a JavaScript program does not end for a long time, the browser may display a warning message and give the user an option to terminate the script. (This may be the case e.g. when scripts perform lengthy computations.) The exact wording and frequency of the warning depends on the browser; for example, Internet Explorer 8.0 displays this Yes/No dialog:

Stop running this script?
A script on this page is causing Internet Explorer to run slowly.
If it continues to run, your computer might become unresponsive.

JavaScript slow script warning

Among all modern browsers, Internet Explorer 8.0 appears to display the slow script warning most frequently. (By default IE8 displays this warning every 5 million JavaScript statements.) To reduce the frequency of the message, you can reconfigure your IE8 or earlier IE versions, as described in the Knowledge Base Article 175500 at Microsoft Support website:

  1. Using a Registry Editor (e.g. Regedt32.exe) open this key:
    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Styles
    If the Styles key is not present, create a new key Styles.
  2. Create or update the DWORD value MaxScriptStatements under Styles.
    Set this value to the desired number of script statements (e.g. 70000000).

Note: Set MaxScriptStatements to a DWORD value 0xFFFFFFFF if you want to turn off the slow script dialog.

See also other JavaScript dialogs:

  • Alert (message box) dialog
  • Confirm dialog
  • Print dialog
  • Find dialog
  • Add Favorite dialog
  • Copyright © 1999-2011, JavaScripter.net.