最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to extend browser script timeout - Stack Overflow

programmeradmin1浏览0评论

I have some JQuery that takes a while to run and after a few second I get the error:

Stop running this script? A script on this page is causing internet explorer to run slowley. If it continues to run, your computer may become unresponsive

Is there a way to extend the timeout? I guess that would mean extending the timeout on the persons machine who browses to the URL

I have some JQuery that takes a while to run and after a few second I get the error:

Stop running this script? A script on this page is causing internet explorer to run slowley. If it continues to run, your computer may become unresponsive

Is there a way to extend the timeout? I guess that would mean extending the timeout on the persons machine who browses to the URL

Share Improve this question edited Jun 4, 2009 at 19:12 Alec Smart 95.9k39 gold badges124 silver badges186 bronze badges asked Jun 4, 2009 at 6:36 timtim
Add a comment  | 

4 Answers 4

Reset to default 6

If you're running your script under Google Chrome, you can disable the hang monitor with the flag: --disable-hang-monitor at the command line.

Under Mozilla based browsers (e.g., Firefox, Camino, SeaMonkey, Iceweasel), go to about:config and change the value of dom.max_script_run_time key.

Under Internet Explorer the maximum instruction allowed to run in a script before seeing timeout dialog is controlled by a registry key :

HKEY_CURRENT_USER\Software\Microsoft\InternetExplorer\Styles\MaxScriptStatements

This is a maximum statements so it shouldn't be related to how fast the computer run. There might be others values that I'm not aware of.

The default value is 5 000 000. Are you doing too much ?

See http://support.microsoft.com/kb/175500.

If you're asking about programmatically changing it, you can't since it is an unsecured action and no browser will allow you to do it.

PS. As suggested above, try to understand the problem and refactor your code to reduce the execution time.

jQuery has its own timeout property. See: http://www.mail-archive.com/[email protected]/msg15274.html

However the message you're getting is not a jQuery issue but a server or architecture issue.

Try to see if you're loading too many Ajax calls at the same time. See if you can change it to handle less calls at a time.

Also, check the server to see how long it takes to get a response. In long running XHR requests the server may take too long to respond. In this case the server-side application or service needs modification.

Hope that helps.

发布评论

评论列表(0)

  1. 暂无评论