扑捉浏览器关闭事件

<script for="window" event="onbeforeunload">
var n = window.event.screenX - window.screenLeft;
    var b = n > document.documentElement.scrollWidth-20;
    //document.body.clientWidth-event.clientX<15
if (b&&event.clientY< 0||event.altKey)
{
   top.location.href="exit.jsp";//当浏览器关闭时,执行exit.jsp页面
     //window.event.returnValue="关闭窗口将停止所有会话!";
   //window.event.returnValue=""; 页面提示
}    
</script>

你可能感兴趣的:(浏览器)