问题
Is there a JS event that gets triggered if a user closes Safari on their iPhone? onunload works if a person leaves a page, but is not called when the browser is closed.
My hunch is, no, there is no event triggered, as closing Mobile Safari merely 'minimizes' it rather than actually closes it. Can anyone confirm?
回答1:
Not exactly, but look in the comments for the pagehide
event: What event fires when a WebKit WebApp is "terminated"
来源:https://stackoverflow.com/questions/5554479/js-event-to-see-if-mobile-safari-has-been-closed