<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<script type="text/javascript">
window.onbeforeunload = onbeforeunload_handler;
function onbeforeunload_handler(){
var warning="确认关闭www.someabcd.com?";
//你的业务操作。。。。
return warning;
}
</script>
</body>
</html>JS监听浏览器窗口关闭
最新推荐文章于 2024-08-22 11:21:06 发布
本文介绍了一种使用JavaScript在网页中实现离开警告的方法。通过监听浏览器的卸载事件,弹出提示框询问用户是否确认离开当前页面。这种方法可以有效防止用户未保存工作即离开网站。
2151

被折叠的 条评论
为什么被折叠?



