如何更改“您确定要离开此页面吗?"的文本"ununload"功能脚本? [英] How to change the text of “Are you sure you want to leave this page?” function script of "onunload"?
问题描述
如何更改此功能脚本的文本?:
How to change the text of this function script?:
window.onbeforeunload = function(e){ return'确定要离开此页面吗?您将丢失所有未保存的数据. };
window.onbeforeunload = function(e) { return 'Are you sure you want to leave this page? You will lose any unsaved data.'; };
我要翻译文本'确定要离开此页面吗?您将丢失所有未保存的数据. 所以它可以用我的语言说同样的话... 怎么做? 请帮忙-谢谢
i want to translate the text " 'Are you sure you want to leave this page? You will lose any unsaved data.' " so it can say the same but in my language... how to do it? Please help - thanks
(当我翻译它时,它在前端不会改变). 预先感谢大家!
(when i translate it, it doesnt change in the frontend). Thanks in advance guys!
推荐答案
更改消息似乎仅在Internet Explorer中有效(请参见 w3schools ).我认为您也不能插入阻塞代码(例如alert()
),因为这将对浏览器造成安全漏洞.
unfortunately, changing the message seems to only work in Internet Explorer (see w3schools). I don't think you'll be able to insert blocking code either(such as alert()
), as it would be a security breach for the browser).
这篇关于如何更改“您确定要离开此页面吗?"的文本"ununload"功能脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!