简体   繁体   中英

Redirect from WEB (js) to Windows Phone app (when not installed - to market)

I have such code ( angular.js ) to detect mobile platform and redirect to native-app (if not installed - then it redirect to market):

$scope.isMobile = {
  Android: function() {
      return navigator.userAgent.match(/Android/i);
  },
  BlackBerry: function() {
      return navigator.userAgent.match(/BlackBerry/i);
  },
  iOS: function() {
      return navigator.userAgent.match(/iPhone|iPad|iPod/i);
  },
  Opera: function() {
      return navigator.userAgent.match(/Opera Mini/i);
  },
  Windows: function() {
      return navigator.userAgent.match(/IEMobile/i);
  },
  any: function() {
      return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
  }
};


if($scope.isMobile.Android()){
  $timeout(function() {
    $window.open(
      'https://play.google.com/store/apps/details?id=***&referrer=' + $routeParams.inviteId,
      '_self'
    );
  }, 500);
}

if($scope.isMobile.iOS()){
  window.location = '***://?referrer=' + $scope.inviteId;
  setTimeout("window.location = 'https://itunes.apple.com/us/app/****/id***';", 1000);
}

and now i have one question:

how to do this on windows phone platform?

do windows phone recognize themselves is app installed or not (as android do) or i need to go as iOS do?\\ also how can i pass parameter to application (like android do)?

The link to app on Windows Phone is: http://windowsphone.com/s?appId={GUID} This opens the page in browser and immediately redirects to the store app.

This document also mentions ms-windows-store://pdp/?ProductId={ID} to open the store directly if you are certain about the platform you're on. It will work on Windows 10, but may be problematic on older platforms.

Note that the {GUID} and {ID} in those links are differnt numbers.

If you are affiliated with the Windows Phone app developer, you can request to implement the URI association feature . Then you can use the custom implemented uri and pass parameters to the app . If the app is not installed, as far as I can remember, the user will be asked if they want to look for apps associated with this uri in the store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM