---
title: "可以检测页面是否刷新,后退.关闭等."
author: "conkeyn"
date: "2008-12-30T14:57:59Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2008-12-30T14:57:59Z"
id: 306980
url: "https://conkeyn.iteye.com/blog/306980"
---

```
<script type="text/javascript">
window.onbeforeunload(){
	if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)   {
		alert("CLOSE   FORM!");
	}else{
	    alert("你在刷新");
	}
}   
</script>
```

 

可以检测页面是否刷新,后退.关闭等.