提交 954b2564 authored 作者: Chad Phillips's avatar Chad Phillips

FS-11283: iOS doesn't support beforeunload, use recommended pagehide for that platform

$.verto.unloadJobs queue leverages the 'beforeunload' event to perform work
prior to browser page unload.

However, iOS does not support that event. Its equivalent event is 'pagehide'.

This patch uses the pagehide event on iOS, and beforeunload for all others.
上级 d5af9296
...@@ -2713,10 +2713,17 @@ ...@@ -2713,10 +2713,17 @@
$.verto.unloadJobs = []; $.verto.unloadJobs = [];
$(window).bind('beforeunload', function() { var unloadEventName = 'beforeunload';
for (var f in $.verto.unloadJobs) { // Hacks for Mobile Safari
$.verto.unloadJobs[f](); var iOS = ['iPad', 'iPhone', 'iPod'].indexOf(navigator.platform) >= 0;
} if (iOS) {
unloadEventName = 'pagehide';
}
$(window).bind(unloadEventName, function() {
for (var f in $.verto.unloadJobs) {
$.verto.unloadJobs[f]();
}
if ($.verto.haltClosure) if ($.verto.haltClosure)
return $.verto.haltClosure(); return $.verto.haltClosure();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论