-2
window.onbeforeunload/window.onunload不工作在鉻檢測瀏覽器關閉事件。需要一些幫助!檢測瀏覽器關閉在jquery/JavaScript跨瀏覽器
window.onbeforeunload/window.onunload不工作在鉻檢測瀏覽器關閉事件。需要一些幫助!檢測瀏覽器關閉在jquery/JavaScript跨瀏覽器
入住這 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>
需要一些代碼! – Bergi 2013-02-18 10:45:19