JS刷新页面和关闭

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

你可能感兴趣的:(JavaScript,浏览器,C#)