window.onbeforeunload = function (e) { var message = '正在排隊(duì)中,請(qǐng)勿關(guān)閉瀏覽器';
e = e || window.event;
if (e) {
e.returnValue = message;
}
return message;
};window.onbeforeunload = function (e) {
e = e || window.event; // 兼容IE8和Firefox 4之前的版本
if (e) {
e.returnValue = '正在排隊(duì)中,請(qǐng)勿關(guān)閉瀏覽器';
} // Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+
return '正在排隊(duì)中,請(qǐng)勿關(guān)閉瀏覽器';
};<body onbeforeunload="return myfunction()">
<script>function myfunction() { return "正在排隊(duì)中,請(qǐng)勿關(guān)閉瀏覽器";
}</script>這三種方式都不行,只顯示瀏覽器的默認(rèn)提示“確定要離開.....” ie,chrome,360,edge都不能顯示自定義的內(nèi)容呀?
1 回答

慕桂英3389331
TA貢獻(xiàn)2036條經(jīng)驗(yàn) 獲得超8個(gè)贊
你的上一個(gè)問題,不是有人已經(jīng)告訴你了。新版本的瀏覽器 beforeunload 不會(huì)再展示自定義的內(nèi)容。
從Firefox 4、 Chrome 51、Opera 38 和Safari 9.1開始,通用確認(rèn)信息會(huì)代替事件返回的字符串。
- 1 回答
- 0 關(guān)注
- 3060 瀏覽
添加回答
舉報(bào)
0/150
提交
取消