2010-08-12 140 views
1

只有在IE浏览器中,当我加载包含javascript的网站时,它会导致页面运行缓慢(并询问是否要停止它),我得到一个警告。IE停止脚本警告

我见过有关这个的其他帖子,我找过任何长时间运行的代码或无限循环等等。奇怪的是,当我选择'否'(而不是终止脚本)页面立即正确加载。它几乎就像这个警告出现在页面加载完成之前。有没有人经历过这个,或者知道为什么会发生这种情况?

+0

改编什么是做网页上的代码?细节总是很好。 – epascarello 2010-08-12 16:05:04

回答

1

IE有自己的方式让你的生活变得不可能。

只要停用警告,您可以在将来进一步研究,如果这是必要的。

这个article可能会帮助您确定IE为什么会发出这样的警告。

问候,

+0

如何禁用警告?我记得看到有关使用注册设置在您的计算机上禁用它的信息。但我怎么能禁用任何人访问该网站? – aeq 2010-08-12 14:19:28

+0

http://ezinearticles.com/?How-to-Get-Rid-of-the-JavaScript-Warning-on-Internet-Explorer&id=3555098这可能有助于 – 2010-08-12 14:19:57

+0

这是关闭您的浏览器..不适合禁止它在任何客户端发生。我想我应该找到警告的来源,而不是禁用它。不过谢谢。 – aeq 2010-08-12 14:23:17

0

http://www.codeproject.com/Tips/406739/Preventing-Stop-running-this-script-in-Browsers

// Magic IE<9 workaround for irritating "Stop running this script?" dialog. 
RepeatOperation = function(anonymousOperation, whenToYield){ 
    var count = 0 
    return function(){ 
     if (++count >= whenToYield){ 
      count = 0 
      setTimeout(function(){anonymousOperation()}, 100) 
     } 
     else anonymousOperation() 
    } 
} 

// How to implement the workaround: 

//for (var i in retailers){ // Too big for IE<9! Use magic workaround: 
var i = 0; var noInArray = retailers.length 
var ro = new RepeatOperation(function(){ 

    // <<Your loop body here, using return instead of continue.>> 

    if (++i < noInArray) ro() 
    else alert("Loop finished.") 
}, 200) // Run this in batches of n. 500 is too much for IE<9. 
ro()