Here is my code:
window.onbeforeunload = function(evt) {
var el = document.getElementById("qandatextarea");
if( el && el.value && !DontAskBeforeExit){
var message='ding ding';
return message;
}
}
But it shows this pop-up:
Why? I never told it this message:
Changes you made may not be saved.
Well where it comes from? And why it doesn't show the message I've defined for it? ( dib ding
)
The result of this is also the same as the above one:
window.onbeforeunload = function(evt) {
var el = document.getElementById("qandatextarea");
if( el && el.value && !DontAskBeforeExit){
var message = 'ding ding';
if (typeof evt == 'undefined') {
evt = window.event;
}
if (evt) {
evt.returnValue = message;
}
return message;
}
}
This functionality has been removed from several major browsers. See the compatibility section on MDN . Notice that there is a section for "Custom text support removed". Chrome 51 and FF 44 have removed the ability to customize the text.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.