IE8 Jquery settimeout每3-4天崩溃一次
我在IE8上运行这个html页面,它每3-4天就会崩溃一次。这里使用settimeout有什么问题吗? 我还使用了proxy,但它没有任何帮助。但它可以在Firefox上运行,没有任何问题IE8 Jquery settimeout每3-4天崩溃一次,jquery,internet-explorer-8,settimeout,isnull,Jquery,Internet Explorer 8,Settimeout,Isnull,我在IE8上运行这个html页面,它每3-4天就会崩溃一次。这里使用settimeout有什么问题吗? 我还使用了proxy,但它没有任何帮助。但它可以在Firefox上运行,没有任何问题 <html> <head> <meta charset="utf-8"> <title>jQuery.proxy demo without proxy</title> <script src="C:\Documents and Set
<html>
<head> <meta charset="utf-8">
<title>jQuery.proxy demo without proxy</title>
<script src="C:\Documents and Settings\xc91977\Desktop\JqueryLib\jquery-1.9.1.js">
</script>
</head>
<body>
<div id="log"></div>
<span></span>
<h1></h1>
<script>
var me = {
_panelRotationTimeout: null,
_showPanel: function(index) {
//Reset index
if (index>10000)
{
index=0;
}
$("div").text("CXY:"+index);
// set timer when to switch to next panel
var that =this;
var ind = index;
this._panelRotationTimeout = setTimeout(function () {
if (that && that._showPanel) {
that._showPanel(ind+1);
}
}, 1000);
$("h1").text("CXY=done:"+index);
}
};
me._showPanel(1);
</script>
</body>
</html>
没有代理的jQuery.proxy演示
var me={
_panelRotationTimeout:null,
_显示面板:功能(索引){
//重置索引
如果(索引>10000)
{
指数=0;
}
$(“div”).text(“CXY:+索引);
//设置切换到下一个面板的时间
var=这个;
var ind=指数;
此._panelRotationTimeout=setTimeout(函数(){
如果(那个&&that.\u显示面板){
显示面板(ind+1);
}
}, 1000);
$(“h1”).text(“CXY=完成:”+索引);
}
};
me._展示面板(1);
这显然是IE8垃圾收集的一个问题。Javascript中的间隔因内存泄漏而臭名昭著。它能运行3-4天,这本身就是一个小小的奇迹。你应该至少每24小时添加一次完全刷新或重新加载页面的内容,否则IE会占用内存直到崩溃。Firefox的Javascript引擎中有更好的GC,这就是它仍在运行的原因,但我敢打赌,如果有更多的时间,它也会崩溃