我有以下代码来检查会话。每15秒调用一次checksession。
此代码在IE浏览器中运行良好,但在Chrome中,警告语句从不会弹出,并且会直接重定向到给定的网址...
setInterval(checksession, 15000)
function checksession() {
alert('check session')
$.ajax({
aynsc: false,
type: 'POST',
url: 'CheckSession',
success: validateresult,
data: {
antiCSRF: '{{acsrf}}',
session_id: '{{session_id}}'
},
error: function () {
alert('Session check failed')
}
})
return false;
}
function validateresult(result) {
if (result == "N") {
valid_flag = "N"
alert("Your session has been timed-out based upon Security Policy. Please click OK to be redirected to the login page to start a new session.");
window.location.assign('./')
} else {
valid_flag = "Y";
return valid_flag
}
}