Is the onbeforeunload event not supported on iPhone?

So, I've got a handy little bit of functionality in place in a jQuery Mobile app that lets the user know if he/she is navigating away from the page, as this will trigger a log off. In 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 just great in both Safari and Chrome on my laptop. However, it doesn't appear to work on the iPhone simulator.

Does the mobile browser included in iOS (I know it's Safari, but presumably a different version) simply not support the beforeunload event? Is this true in general for mobile devices (in particular, Android)?


The iPhone indeed does not support onbeforeunload

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

链接地址: http://www.djcxy.com/p/89968.html

上一篇: jQuery使用动画在移动设备上滚动iframe

下一篇: iPhone上不支持onbeforeunload事件吗?