浏览器关闭窗口时给后台发请求 刷新时不做操作
// 检测浏览器窗口关闭
var _beforeUnload_time = 0,_gap_time=0;
window.οnunlοad=function(){
_gap_time=new Date().getTime()-_beforeUnload_time;
if(_gap_time<=5){
//浏览器关闭
$.ajax({
url:'/movecheck/logout',
// dataType:"JSON",
cache:false,
type:'post',
async:false,
success:function(dt){
// console.log(dt)
},
error:function(dt){
}
})
}
}
window.οnbefοreunlοad=function(){
_beforeUnload_time=new Date().getTime();
}
});
===&