我想改变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.
请问有什么好的方法吗,或者捷径?