如何扩展浏览器脚本超时

时间:2021-11-14 21:16:42

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

我有一些JQuery需要一段时间才能运行,几秒后我得到错误:

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

停止运行此脚本?此页面上的脚本导致Internet Explorer运行slowley。如果它继续运行,您的计算机可能会无响应

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

有没有办法延长超时?我想这意味着延长浏览URL的人机的超时时间

4 个解决方案

#1


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.

如果您在Google Chrome下运行脚本,则可以在命令行中使用以下标志禁用挂起监视器: - disable-hang-monitor。

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.

在基于Mozilla的浏览器(例如,Firefox,Camino,SeaMonkey,Iceweasel)下,转到about:config并更改dom.max_script_run_time键的值。

#2


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

在Internet Explorer下,在查看超时对话框之前允许在脚本中运行的最大指令由注册表项控制:

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 ?

默认值是5 000 000.你做得太多了吗?

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

#3


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.

PS。如上所述,尝试了解问题并重构代码以减少执行时间。

#4


jQuery has its own timeout property. See: http://www.mail-archive.com/jquery-en@googlegroups.com/msg15274.html

jQuery有自己的超时属性。请参阅:http://www.mail-archive.com/jquery-en@googlegroups.com/msg15274.html

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

但是,您收到的消息不是jQuery问题,而是服务器或体系结构问题。

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.

试着看看你是否同时加载了太多的Ajax调用。看看你是否可以改变它来一次处理更少的电话。

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.

另外,检查服务器以查看获取响应所需的时间。在长时间运行的XHR请求中,服务器可能需要很长时间才能响应。在这种情况下,服务器端应用程序或服务需要修改。

Hope that helps.

希望有所帮助。

#1


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.

如果您在Google Chrome下运行脚本,则可以在命令行中使用以下标志禁用挂起监视器: - disable-hang-monitor。

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.

在基于Mozilla的浏览器(例如,Firefox,Camino,SeaMonkey,Iceweasel)下,转到about:config并更改dom.max_script_run_time键的值。

#2


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

在Internet Explorer下,在查看超时对话框之前允许在脚本中运行的最大指令由注册表项控制:

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 ?

默认值是5 000 000.你做得太多了吗?

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

#3


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.

PS。如上所述,尝试了解问题并重构代码以减少执行时间。

#4


jQuery has its own timeout property. See: http://www.mail-archive.com/jquery-en@googlegroups.com/msg15274.html

jQuery有自己的超时属性。请参阅:http://www.mail-archive.com/jquery-en@googlegroups.com/msg15274.html

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

但是,您收到的消息不是jQuery问题,而是服务器或体系结构问题。

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.

试着看看你是否同时加载了太多的Ajax调用。看看你是否可以改变它来一次处理更少的电话。

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.

另外,检查服务器以查看获取响应所需的时间。在长时间运行的XHR请求中,服务器可能需要很长时间才能响应。在这种情况下,服务器端应用程序或服务需要修改。

Hope that helps.

希望有所帮助。