页面关闭IE触发事件方法

function window.onbeforeunload(){       
    //用户点击浏览器右上角关闭按钮或是按alt+F4关闭
    if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey){  
      //删除用户
      location.href="account_logout.action";
    }else if(event.clientY > document.body.clientHeight || event.altKey){ //用户点击任务栏,右键关闭。s或是按alt+F4关闭
    location.href="account_logout.action";
    }
}

猜你喜欢

转载自xiyuliuguang.iteye.com/blog/1949354