问题描述
有很多问题、博客文章等来解释如何自定义浏览器离开页面时会发出的 beforeunload
消息。
归结为以下几点:
window.onbeforeunload = function() {
return 'Place your message here'
}
如果您返回空字符串,则返回浏览器的默认完全本地化消息:
window.onbeforeunload = function() {
return ''
}
我想知道 Javascript 是否能够做相反的事情:获取/读取默认的本地化消息。因此,例如在伪代码中类似
const message = browser.messages.beforeunload
// Chrome EN : message = "Are you sure you want to leave this page?"
// Chrome NL : message = "Ben je zeker dat je deze pagina wilt verlaten?"
// Firefox : message = "This page is asking you to confirm that you want to leave..."
// ....
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)