Onbeforeunload event not supported on iPhone?

So, I have a handy little functionality in the jQuery Mobile application that allows the user to find out if he is moving from the page, as this will disable the log. In a simplified form:

$(window).bind('beforeunload', function() { return "Navigating away from this page will log you off. Are you sure you want to continue?"; }); $(window).unload(function() { logoff(); }); 

This works great in both Safari and Chrome on my laptop. However, it does not work on the iPhone simulator.

Is the mobile browser turned on in iOS (I know it's Safari, but presumably a different version) just doesn't support the beforeunload event? Is this true in general for mobile devices (in particular, Android)?

+7
source share
1 answer

iPhone really doesn't support onbeforeunload

This question has a possible workaround: Is there a way to use window.onbeforeunload for Mobile Safari for iOS devices?

+7
source

All Articles