Redirect users to iTunes app store or google play store? Redirect users to iTunes app store or google play store? ios ios

Redirect users to iTunes app store or google play store?


If you want to roll your own and not use a third party, there's also a Javascript solution:

<!DOCTYPE html><html lang="en"><head>    <meta charset="utf-8" /><script>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";}</script><script>function DetectAndServe(){    let os = getMobileOperatingSystem();    if (os == "Android") {        window.location.href = "http://www.Androidexample.com";     } else if (os == "iOS") {        window.location.href = "http://www.IOSexample.com";    } else if (os == "Windows Phone") {        window.location.href = "http://www.WindowsPhoneexample.com";    } else {        window.location.href = "http://www.NowherLandexample.com";    }}</script></head><body onload="DetectAndServe()"></body></html>


U mean something like this?

Onelink

How to use onelink.to

onelink.to is the easy and fuss-free way to link to your app!

Just add the URLs to your app and we will determine which to use every time someone is using your onelink.to address.

You can use onelink.to free of charge, both for private and commercial use. We have no plans to change that.

And you can also add a fallback url to your website.

Hope this helps u out.


In PHP you can use something like:

<?php$iPod    = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");$iPhone  = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");$iPad    = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");$webOS   = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");//do something with this informationif( $iPod || $iPhone ){    //browser reported as an iPhone/iPod touch -- do something here    $string = "Location: <<your itunes app link>>";    header($string);    die();}else if($iPad){    //browser reported as an iPad -- do something here    $string = "Location: <<your itunes app link>>";    header($string);    die();}else if($Android){    //browser reported as an Android device -- do something here    $string = "Location: <<Google Play Link>>";    header($string);    die();}else if($webOS){    //browser reported as a webOS device -- do something here    $string = "Location: <<Your Page link>>";    header($string);    die();}else{    //browser reported as PC -- do something here    $string = "Location: <<Your Page link>>";    header($string);    die();}?>

You can use links for iTunes or Android, respectively:

itms-apps://itunes.apple.com/app/<<App ID>>market://details?id=<<Package id>>

I donĀ“t remember the source, but at least it works for me for sharing in other apps like Whatsapp, but unfortunately is not working on Facebook.

The problem in Facebook is that they use the metadata of the final link on the path of redirections, and the link points to GooglePlay store.