mercredi 11 janvier 2017

Why isn’t there a Web API to open native app and redirect to store if not installed?

From experience, opening native apps from a web page and redirecting to the store if app doesn’t exist is a mess.

It’s usually a hack like this :

setTimeout(function () {
  window.location = isIOS ? iOSUrlStore : androidUrlStore;
}, 3000);
window.location = "yourapp://url";

It fails a lot depending the device so you need to fine tune the timeout delay before redirecting to the store.

Why isn‘t a JavaScript API available like below which handle the opening of the app and redirecting to the store otherwise ?

navigator.openApp({
   android: androidAppID,
   iOS: iosAppId
})




Aucun commentaire:

Enregistrer un commentaire