Глубокая связь с Javascript не работает для браузера Safari - PullRequest
0 голосов
/ 25 сентября 2019

Я открываю приложение, если установлено или по ссылке PlayStore.Он хорошо работает во всех современных браузерах.Однако в Safari происходит то, что мое приложение открывается, а также открывается ссылка на App Store.Кто-нибудь может помочь мне определить проблему?

(function() { 
  var app = {  
    launchApp: function() {
      var operating_system = getMobileOperatingSystem();
      //alert(operating_system);
      if (operating_system == "iOS") {
        //window.location.replace("GiftCast://"); //if app installed
        window.location.replace("App://"); //if app installed
      } else {
        window.location.replace("myapp://mytest/login");
      }
      // window.location.replace("intent://#Intent;action=android.intent.action.SEND,package=com.abcd.asd;end");         
      this.timer = setTimeout(this.openWebApp, 1000);  
    },
    openWebApp: function() {
      var operating_system = getMobileOperatingSystem();
      //alert(operating_system);
      if (operating_system == "iOS")
        window.location.replace("https://itunes.apple.com/app/idss11?mt=8");
      else
        window.location.replace("https://play.google.com/store/apps/details?id=com.appname.Live"); //if app  not installed then play store
        //window.location.replace("myapp://mytest/login");        
    } 
  };
   
  app.launchApp();
  //app. openWebApp();
})();

/**
 * Determine the mobile operating system.
 * This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'.
 *
 * @returns {String}
 */
function getMobileOperatingSystem() {
  var userAgent = navigator.userAgent || navigator.vendor || window.opera;

  // Windows Phone must come first because its UA also contains "Android"
  if (/windows phone/i.test(userAgent)) {
    return "Windows Phone";
  }

  if (/android/i.test(userAgent)) {
    return "Android";
  }

  // iOS detection from: http://stackoverflow.com/a/9039885/177710
  if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
    return "iOS";
  }

  return "unknown";
}
...