【问题标题】:Redirect users to iTunes app store or google play store?将用户重定向到 iTunes 应用商店或 Google Play 商店?
【发布时间】:2016-05-27 14:25:21
【问题描述】:

我正在寻找一种简单的解决方案来发布我的应用的一个链接,例如在 Facebook 上,如果用户使用移动设备访问它,它应该会自动重定向到正确的应用商店。否则用户应该被重定向到我的网站。

iOS 应用程序: http://itunes.apple.com/de/app/dawawas/id588285122

安卓应用: https://play.google.com/store/apps/details?id=de.conceptspace.dawawas.greenturtle&hl=en

网站: https://www.dawawas.com/

【问题讨论】:

    标签: android ios iphone facebook


    【解决方案1】:

    你可以使用简单的javascript代码

    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    
    <script>
        $(document).ready(function () {
            if (navigator.userAgent.toLowerCase().indexOf("android") > -1) {
                window.location.href = 'market://details?id=<appID>';
            }
            if (navigator.userAgent.toLowerCase().indexOf("iphone") > -1) {
                window.location.href = 'itms-apps://itunes.apple.com/app/<appID>';
            }
        });
    </script>
    

    或者如果使用 .net 可以使用

    Dim systOS = Request.UserAgent.ToString.ToLower
        
        If (systOS.IndexOf("android").ToString.ToLower > 0) Then
            Response.Redirect("market://details?id=com.manomayelectronics")
            
        ElseIf (systOS.IndexOf("iPod").ToString.ToLower > 0) Then
             Response.Redirect("itms-apps://itunes.apple.com/app/com.manomayelectronics")
     End if
    

    或者如果使用 PHP 可以使用

    <?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");
    
    
    //do something with this information
    if( $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();
    }
    

    问候 多核解决方案。 https://multicoresolutions.in/

    【讨论】:

      【解决方案2】:

      我们一直在寻找一种解决方案,将用户引导至正确的 App Store,并携带额外的元数据,以便在 App Store 安装后启动应用程序时,它会知道用户来自哪里并启动特定活动。

      因此,如果像我这样的任何其他人点击这篇 Stack Overflow 文章,获得 OP 要求以及携带额外元数据(并跟踪所有转换)的额外好处的提示是查看 Firebase 动态链接:@ 987654321@

      【讨论】:

        【解决方案3】:

        如果你想自己滚动而不使用第三方,还有一个 Javascript 解决方案:

        <!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>
        

        【讨论】:

          【解决方案4】:

          在 PHP 中你可以使用类似的东西:

          <?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 information
          if( $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();
          }
          
          
          ?>
          

          您可以分别使用 iTunes 或 Android 的链接:

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

          我不记得来源,但至少它适用于我在 Whatsapp 等其他应用程序中分享,但不幸的是在 Facebook 上不起作用。

          Facebook 的问题是他们在重定向路径上使用最终链接的元数据,并且链接指向 GooglePlay 商店。

          【讨论】:

            【解决方案5】:

            您可以通过后端创建该功能。只需创建一个 PHP 脚本或后端使用的任何语言。这里我假设 PHP。

            只需创建一个 php 脚本即可确定您使用的是 iphone 还是 android 或 web。请查看此链接以获取 php 脚本 Mobile or desktop browser detection and redirect to respective web page

            并将其重定向到相应的 Url.Like 您可以使用带有 php 文件的站点 url https://www.dawawas.com/detect_mobile.php

            一个用户将分享这个网址,当另一个用户点击上面的链接时,php脚本将确定它是ios还是android还是web,相应的链接将通过重定向自动打开

            我已经在我们的 ios 应用中实现了这个。

            【讨论】:

              【解决方案6】:

              你的意思是这样的?

              Onelink

              如何使用onelink.to

              onelink.to 是链接到您的应用程序的简单而轻松的方式!

              只需将网址添加到您的应用中,我们就会确定每次有人使用您的 onelink.to 地址时使用哪个网址。

              您可以将 onelink.to 免费用于私人和商业用途。我们没有改变这一点的计划。

              您还可以向您的网站添加一个后备网址

              希望对你有所帮助。

              【讨论】:

              • 目标是不使用第三方的。
              • The objective is not to use third party´s 你在哪里读到这个?他想要一个简单的解决方案,因此第三方可以成为他想要的解决方案。
              • 如果应用已安装,您能否使用此第 3 方导航到某个活动/页面?
              • 后备网址在单行中效果不佳。我从我的计算机重定向到计算机上的 Play 商店,而不是后备链接。
              • 我需要将appsflyer链接放在苹果/谷歌链接区域,但在线阻止了这些链接。有什么办法可以克服吗?
              【解决方案7】:

              您可以使用http://toSto.re 同时为 iTunes 和 Google Playstore 创建一个短链接。

              只需选择一个名称,然后输入不同的应用商店网址,您就会得到一个链接,例如 toSto.re/facebook,它会根据用户代理自动指向正确的网址,甚至支持 Google Analytics 对某些统计信息的迭代。

              【讨论】:

              • 最大的缺点之一是不能编辑创建的url。
              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2014-10-02
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多