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
1 changed files with 11 additions and 4 deletions

View File

@ -2713,10 +2713,17 @@
$.verto.unloadJobs = [];
$(window).bind('beforeunload', function() {
for (var f in $.verto.unloadJobs) {
$.verto.unloadJobs[f]();
}
var unloadEventName = 'beforeunload';
// Hacks for Mobile Safari
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)
return $.verto.haltClosure();