如何改变window.onbeforeunload的提示信息

migan2008 2014-03-24 04:27:57
我想改变onbeforeunload 的返回信息。
window.onbeforeunload = function() {
return 'You have unsaved changes!';
}


$(window).bind('beforeunload', function() {} );


我想改变这个return 值,比如输出"You have unsaved changes"。PC上是能改变这个值,但是在android上测试时,一直输出默认语句。网上查了查,Internet Explorer Dev Center上说:
When a string is assigned to the returnValue property of window.event, a dialog box appears that gives users the option to stay on the current document and retain the string that was assigned to it. The default statement that appears in the dialog box, "Are you sure you want to navigate away from this page? ... Press OK to continue, or Cancel to stay on the current page.", cannot be removed or altered.

请问有什么好的方法吗,或者捷径?
...全文
1219 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
migan2008 2014-03-25
  • 打赏
  • 举报
回复
顶一顶~~~~
migan2008 2014-03-24
  • 打赏
  • 举报
回复
顶上去

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧