Still have a problem? Ask for help at our discussion forum.

Advanced Search
Article Options
Popular Articles
  1. Windows Mail Spell Check Language is no longer available for Spell Checking
  2. Windows Vista Wallpaper
  3. An Error Has Occurred in the Script on This Page
  4. Windows Vista Release Schedule
  5. Windows Vista
No popular articles found.

 »  Home  »  Internet Explorer Page 1  »  Set Time Out Period for Script
Set Time Out Period for Script
By  Super Admin  | Published  11/23/2006 | Internet Explorer Page 1 | Rating:
Set Time Out Period for Script

There are situations when a Web page contains script that takes an unusually long time to run. If you are scripting an ActiveX control on a Web page to transfer a very large file or do a large database query, this will often cause a significantly long delay. Internet Explorer 3.02 detects the long delay and prompts the user with a dialog box reading the following:

This page contains a script which is taking an unusually long time to finish. To end this script now, click Cancel.
The equivalent message box for Internet Explorer versions 4.0, 5.0, 6, and 7 reads:

A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?"
This mechanism allows the user to stop misbehaved script that runs into an endless loop or otherwise is performing slowly.

In Internet Explorer 3.02, this message box can appear on machines running Windows 95. The version 3.02 browser is specifically looking to see if the script thread has pumped any windows messages in the last five seconds. There is no way to override this time-out period for Internet Explorer 3.02. If you are using an ActiveX control with long blocking operations, that ActiveX control should either employ an event mechanism and return control to the caller or call PeekMessage every five seconds to reset the time-out.

As of Internet Explorer 4.0, 5.0, 6, and 7, the time-out is no longer a fixed value based on Windows messages. Internet Explorer now tracks the total number of executed script statements for the current page with the script engine and throws up the time-out dialog box when that value hits a threshold amount.

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To change this time-out value in Internet Explorer 4.0, 5.0, 6, or 7, follow these steps: 1. Using a Registry Editor such as Regedt32.exe, open this key:

Note If the Styles key is not present, create a new key that is called Styles.
2. Create a new DWORD value called "MaxScriptStatements" under this key and set the value to the desired number of script statements. 
By default the key doesn't exist. If the key has not been added, Internet Explorer 4 defaults to 5,000,000 statements executed as the trigger for the time-out dialog box.

Because the Internet Explorer 4.0, 5.0, 6, and 7 time-out is based on the number of script statements executed, the time-out dialog box will not display during ActiveX control or database-access delays. Endless loops in script will still be detected.

How would you rate the quality of this article?
1 2 3 4 5
Poor Excellent
Tell us why you rated this way (optional):

Send to Author Post on Site

  • Comment #1 (Posted by an unknown user)
    Immediately solved the problem of IE 'hanging' whilst I was developing some bug-ridden Javascript.
Submit Comment