Is the onbeforeunload event not supported on iPhone?

Dan Tao picture Dan Tao · Aug 1, 2011 · Viewed 22.1k times · Source

Looks like Apple has disabled the window.onbeforeunload event for iOS devices (iPhone, iPad, iPod Touch). Unfortunately I can't find any documentation as to why this event doesn't work in Mobile Safari.

Does anyone know if there's a reliable alternative to this function? Android's browser appears to support it just fine, and the Safari desktop application also supports the onbeforeunload event without issue.

Answer