gpt4 book ai didi

javascript - 为什么确认弹出窗口不显示我为其定义的消息?

转载 作者:行者123 更新时间:2023-12-02 14:12:50 24 4
gpt4 key购买 nike

这是我的代码:

window.onbeforeunload = function(evt) {
var el = document.getElementById("qandatextarea");
if( el && el.value && !DontAskBeforeExit){
var message='ding ding';
return message;
}
}

但它显示了这个弹出窗口:

enter image description here

为什么?我从来没有告诉过它这个消息:

Changes you made may not be saved.

那么它从哪里来呢?为什么它不显示我为其定义的消息? (迪布丁)

<小时/>

这样的结果也和上面的一样:

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;
}
}

最佳答案

此功能已从多个主要浏览器中删除。请参阅the compatibility section on MDN 。请注意,有一个“自定义文本支持已删除”部分。 Chrome 51 和 FF 44 删除了自定义文本的功能。

关于javascript - 为什么确认弹出窗口不显示我为其定义的消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39357342/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com