[英]Javascript how to confirm browser close in Safari on iOS
Is there a way in javascript to show a confirmation alert and give the user an opportunity to cancel before closing browser/tab in mobile safari? 有没有办法在javascript中显示确认提醒并让用户有机会在关闭移动版Safari中的浏览器/标签之前取消? Since onbeforeunload is not supported I'm wondering if there's another way to interrupt the process? 由于不支持onbeforeunload,我想知道是否有另一种方法来中断进程?
Have you looked at Apple's Documentation? 你看过Apple的文档吗?
https://developer.apple.com/library/IOS/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW5 https://developer.apple.com/library/IOS/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW5
document.unload
should work but is deprecated. document.unload
应该可以工作但不推荐使用。 document.pagehide
is recommended. 建议使用document.pagehide
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.