tmlfile 长连接超时断开问题
我发现把iframe放到htmlfile中与服务端建立的长连接会断开,最后发现是由于IE的垃圾回收引起的,简单的解决办法如下面的红色字体显示:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<script>
function tranH(i)
{
document.getElementsByName("tt")(0).value=i;
}
function rpc_iframe()
{
var transferDoc = new ActiveXObject("htmlfile"); // neue Seite
transferDoc.open();
transferDoc.write("<html>")
transferDoc.write("<div><iframe src=\"http://127.0.0.1:8080/wis/1.kp\"></iframe></div>");
transferDoc.close("</html>");
transferDoc.parentWindow.tranH= tranH;
setInterval( function () {}, 10000);
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body onLoad="rpc_iframe()">
<input name="tt" type="text" value="tt">
</body>
</html>
"http://www.w3.org/TR/html4/loose.dtd">
<script>
function tranH(i)
{
document.getElementsByName("tt")(0).value=i;
}
function rpc_iframe()
{
var transferDoc = new ActiveXObject("htmlfile"); // neue Seite
transferDoc.open();
transferDoc.write("<html>")
transferDoc.write("<div><iframe src=\"http://127.0.0.1:8080/wis/1.kp\"></iframe></div>");
transferDoc.close("</html>");
transferDoc.parentWindow.tranH= tranH;
setInterval( function () {}, 10000);
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body onLoad="rpc_iframe()">
<input name="tt" type="text" value="tt">
</body>
</html>