浏览器onbeforeunload
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h2>浏览器的各种事件</h2>
<input type="text" name="" id="" value="" />
<script type="text/javascript">
//刷新页面生效 页面内容改变以后离开当前页面 或者关闭当前页面生效
window.onbeforeunload=function(e){
var e = window.event||e;
e.returnValue=("确定离开当前页面吗?");
}
</script>
</body>
</html>

浙公网安备 33010602011771号