javascript - How to customize the message "Changes you made may not be saved." for window.onbeforeunload? -
i testing in google chrome.
i did search , found using:
window.onbeforeunload = function() { if (hook) { return "did save stuff?" } }
but when use it, still got "changes made may not saved." message. how can change want?
thanks!
you can't, ability removed in chrome 51. considered security issue, , vendors have removed support.
custom messages in onbeforeunload dialogs (removed):
a window’s onbeforeunload property may set function returns string. if function returns string, before unloading page, dialog shown have user confirm indeed want navigate away. string provided function no longer shown in dialog. rather, generic string not under control of webpage shown.
comments
this shipped in safari 9.1, , has been shipping in firefox since firefox 4. safari considers security fix , assigned cve-2009-2197 (see https://support.apple.com/en-us/ht206171 ). approved intent https://groups.google.com/a/chromium.org/d/msg/blink-dev/yih8coyvgsg/di7tsljxdqaj .
specification
status in chromium
removed (launch bug) in:
- chrome desktop release 51
- chrome android release 51
- android webview release 51
- opera release 38
- opera android release 38
Comments
Post a Comment