停止运行此脚本 [英] Stop running this script

查看:119
本文介绍了停止运行此脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


停止运行此脚本?

Stop running this script?

此页面上的脚本导致
Internet Explorer运行缓慢。如果
继续运行,您的计算机可能会变成没有响应的

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

我确信我们已经所有人都看到了来自IE7的这个有用且信息丰富的错误消息(或者更确切地说是IE7模式下的IE8)。我需要一些帮助才能删除此消息。

I'm sure we've all seen this useful and informative error message from IE7 (or rather IE8 in IE7 mode). I need some help with removing this message.

因此,对于我的工作,我需要让我们的网站在IE7中运行。显然,我们的一些客户无法升级或使用其他浏览器(公司法规或其他内容)。

So, for my work, I need to get our website working in IE7. Apparently, some of our clients can't upgrade or use another browser (corporate regulations or something).

无论如何,有问题的页面包含标签(使用jQueryUI)。页面加载后,jQuery使用AJAX加载每个选项卡的数据;使用队列逐个加载选项卡。在每个选项卡中,都有小部件,其中包含HTML和JavaScript(对于每个选项卡加载,都有各种脚本标记)。

Anyway, the page in question contains tabs (using jQueryUI). After the page loads, jQuery loads the data for each tab using AJAX; the tabs are loaded one by one, using a queue. In each tab, there are 'widgets' which contain HTML and JavaScript (for each tab load, there are various script tags).

我收到'慢脚本'加载选项卡时出错。我知道当脚本没有将控制权返回给浏览器时,IE讨厌。所以,我想知道是否有办法'返回控制'或以某种方式睡觉,所以IE可以'重置'它的慢速脚本计数器。

I am getting the 'slow script' error during the loading of the tabs. I know that IE hates when scripts don't return control to the browser. So, I was wondering if there was a way to 'return control' or sleep somehow, so IE can 'reset' it's slow script counter.

推荐答案

有人提出了一个想法这里


避免'脚本采取浏览器中的消息太长(所有浏览器都有某种形式或其他形式)消息相对简单。您只需要确保浏览器知道您没有创建无限循环或递归。最简单的方法是让浏览器在长时间运行的任务之间休息一下。

Avoiding the 'Script taking too long' (all browsers have some form or another of this) message in browsers is relatively simple. You just have to make sure the browser knows you have not created an endless loop or recursion. And the easiest way to do is is to just give the browser a breather in between long running tasks.

那么我们将如何解决这个问题。最简单的解决方案是在这些任务之间使用setTimeout将您的任务分解为多个较小的任务。该实用程序(参见链接)只做这个

So how would we go about this. Well the simplest solution is to just break up your task into mutliple smaller tasks with a setTimeout in between these tasks. The utility (see link) does just this

这篇关于停止运行此脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆