diff --git a/lib/public/script.js b/lib/public/script.js index 80dcaa3..8601ee7 100644 --- a/lib/public/script.js +++ b/lib/public/script.js @@ -5,7 +5,8 @@ function deepLink(options) { var androidPackageName = options.android_package_name; var playStoreLink = 'https://market.android.com/details?id=' + androidPackageName; - var ua = window.navigator.userAgent; + var navigator = window.navigator; + var ua = navigator.userAgent; // split the first :// from the url string var split = url.split(/:\/\/(.+)/); @@ -32,7 +33,13 @@ function deepLink(options) { return /Android/i.test(ua); }, ios: function () { - return /iPhone|iPad|iPod/i.test(ua); + if (/iPad|iPhone|iPod/.test(ua)) { + return true; + } else { + return navigator.maxTouchPoints && + navigator.maxTouchPoints > 2 && + /Macintosh/.test(ua); + } }, }; @@ -49,7 +56,7 @@ function deepLink(options) { document.location = url; setTimeout(function () { document.location = fallback; - }, 250); + }, 2500); } function launchIframeApproach(url, fallback) { @@ -75,7 +82,7 @@ function deepLink(options) { // chrome and safari on ios >= 9 don't allow the iframe approach if ( ua.match(/CriOS/) || - (ua.match(/Safari/) && ua.match(/Version\/(9|10|11|12)/)) + (ua.match(/Safari/) && ua.match(/Version\/(9|10|11|12|13|14|15)/)) ) { launchWekitApproach(urls.deepLink, urls.iosStoreLink || urls.fallback); } else {