Merge pull request #1547 in FS/freeswitch from ~THEHUNMONKGROUP/freeswitch:bugfix/FS-11283-ios-doesn-t-support-beforeunload to master

* commit '954b2564b2e4582949825988f30dde3fb16d1347':
  FS-11283: iOS doesn't support beforeunload, use recommended pagehide for that platform
This commit is contained in:
Christopher Rienzo 2018-08-22 21:41:18 +00:00
commit fc26aa9785

View File

@ -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();