0
我想改變之前窗口卸載瀏覽器的消息,下面是代碼我試圖在如何改變瀏覽器的消息上beforeunload
var displayMessage = true;
$(window).bind('beforeunload', function(){
if(displayMessage){
var message = '-- You specify a custom message here ---'+'\n Thanks for visiting my site!';
return message;
}
});
工作與上面的代碼的消息我得到Firefox是
本頁面要求確認您要離開 - 您輸入的數據可能未保存。
如何改變這種自定義消息
可能重複[如何重寫OnBeforeUnload對話框並將其替換爲我自己的?](http://stackoverflow.com/questions/276660/how-can-i-override-the- onbeforeunload-dialog-and-replace-it-with-my-own) – Manwal 2014-09-12 10:35:57
有些瀏覽器顯示你的消息伴隨着他們自己的,有些則不然。這樣做是爲了防止詐騙或任何其他惱人的行爲。 – MMM 2014-09-12 10:41:59