var xmlhttp;
var tick=60000;
function headtick()
{
window.setTimeout(headtick,tick);
var url="/Ajax/CheckHeadTickToken.aspx";
if(window.ActiveXObject)
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
xmlhttp.open("POST", url, false);
xmlhttp.onreadystatechange = CheckLoginResult;
xmlhttp.setRequestHeader("If-Modified-Since","0");
xmlhttp.send("");
}
function CheckLoginResult()
{
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
var result = xmlhttp.responseText;
if(result!="true")
{
var dt=new Date();
//alert('对不起,token已经过期!'+dt.getMinutes()+' '+dt.getSeconds());
window.top.location.href='/Default.aspx';
}
}
}
}
window.setTimeout(headtick,tick);
本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/archive/2011/08/02/2125071.html,如需转载请自行联系原作者