页面刷新被阻塞的问题
为了检测人员在线,在页面上通过刷新或轮询的方式探测人员的请求时间
方式1:
<html>
<head>
<meta http-equiv="REFRESH" content="15;URL=/liveAction.do">
</head>
</html>
方式2:
<script language="javascript">
function shakehand()
{
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
xmlhttp.open("POST", "/liveAction.do", false);
xmlhttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
xmlhttp.send();
}
setInterval("shakehand()", 15000); //15秒钟发送一次请求
</script>
结果当页面上执行
alert(msg);
function warnclose()
{
msg = "-----------------------------------------------------------\n";
msg += "----------------------你真的要退出吗?----------------------\n";
msg += "-----------------------------------------------------------";
event.returnValue = msg;
}
停顿过程中页面刷新的操作被屏蔽
请大家指点