window.onbeforeunload / window.onunload 在 chrome 中无法检测浏览器关闭事件。需要一些帮助!
问问题
4636 次
1 回答
2
检查这个 http://help.dottoro.com/ljhtbtum.php
示例 http://help.dottoro.com/external/examples/ljhtbtum/onbeforeunload_1.htm
代码
<head>
<script type="text/javascript">
function OnBeforeUnLoad () {
return "All data that you have entered will be lost!";
}
</script>
</head>
<body onbeforeunload="return OnBeforeUnLoad ()">
<b>Close this window or press F5 to reload the page.</b>
<br /><br />
<form>
User name: <input type="text" name="username" />
<br />
City: <input type="text" name="city" />
</form>
</body>
于 2013-02-18T10:46:26.580 回答