我想要一个脚本,当它从 Firefox 浏览器中的页面退出时,它可以向用户显示自定义消息。即使在使用自定义消息后,Firefox 也会显示其默认消息,尽管 chrome 可以正确显示它。但我也想在 Firefox 中显示此自定义消息
window.onbeforeunload = function() {
return 'Are you sure.';
}
最佳答案
看来他们故意禁用了它:https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload
In Firefox 4 and later the returned string is not displayed to the user. Instead, Firefox displays the string "This page is asking you to confirm that you want to leave - data you have entered may not be saved."
请参阅此相关问题以获取潜在的解决方法,但所有这些都非常困惑:
关于javascript - 有什么方法可以在退出firefox浏览器时显示自定义消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32185577/