Safari手机中的javascript卸载事件? [英] javascript unload event in safari mobile?

查看:78
本文介绍了Safari手机中的javascript卸载事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQtouch和jQuery开发适用于iPad的Web应用程序.该Webapp可在商店中使用,并通过AVD浏览器查看,当设备摇晃或断电时,该应用程序会向我发送电子邮件警报.但是,我也想知道webapp何时关闭.我试图使用$(window).bind('unload',function(){});但在Safari Mobile和AVD浏览器中均无法使用.我怎样才能使它正常工作?

I'm working on a webapp for iPad with jQtouch and jQuery. The webapp is used in a store and viewed through AVD browse which send me email alerts when the device is shook or disconnected from power. However, I also want to know when the webapp has been closed. I tried to use $(window).bind('unload', function(){}); but it doesn't work neither in Safari Mobile nor AVD browse. How can I get it to work?

推荐答案

我有一个答案.这不是我们所希望的.

I have an answer. It's not what we were hoping for.

http://www卸载的技术定义. w3.org/TR/DOM-Level-2-Events/events.html 是:

当DOM发生卸载事件 实现从中删除文档 窗口或框架.此活动有效 用于BODY和FRAMESET元素.

The unload event occurs when the DOM implementation removes a document from a window or frame. This event is valid for BODY and FRAMESET elements.

我还从苹果公司的一些知情人士那里得到了答复:不幸的是,我无法找到单击主页"按钮时会触发的事件!我认为最合适的事件可能是页面隐藏当您切换到标签"视图以打开新页面时,此事件实际上会在iOS的Safari中触发,但当您单击主屏幕图标:-("

I also got a reply from some in the know at Apple: "Unfortunately, I haven't been able to find an event that fires when the Home button is clicked! I think the most appropriate event for this might be the pagehide event. This event actually does fire in Safari on iOS when you switch to the "tabs" view to open a new page, but not when you click the home screen icon :-("

这篇关于Safari手机中的javascript卸载事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆