JS刷新页面跟关闭

JS刷新页面和关闭scriptwindow.onbeforeunloadfunction (){alert(onbeforeunload)if(event.cl

JS刷新页面和关闭

<script>window.onbeforeunload=function (){alert("===onbeforeunload===");if(event.clientX>document.body.clientWidth && event.clientY < 0 || event.altKey){     alert("你关闭了浏览器");}else{     alert("你正在刷新页面");}}</script>