akronymn
akronymn

Reputation: 2446

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? Since onbeforeunload is not supported I'm wondering if there's another way to interrupt the process?

Upvotes: 5

Views: 1084

Answers (1)

JAL
JAL

Reputation: 42449

Have you looked at Apple's Documentation?

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.pagehide is recommended.

Upvotes: 1

Related Questions