相关疑难解决方法(0)

重定向到appstore或谷歌播放

我将以下列格式向我的客户发送应用程序的链接

http://goo.gl.com/downloadtheapp(或其他)

我希望这个文件在我的服务器上的某个地方,包括检查设备类型是什么的java脚本代码,并重定向到方便的商店.也就是说,如果该设备是基于Android的谷歌播放和如果该设备是基于ios的appstore.

到现在为止我试过这个,但它不起作用.

<html>
<head>
<script type="text/javascript">
        $(document).ready(function () 
    {
        if(navigator.userAgent.toLowerCase().indexOf("android") > -1)
        {
            window.location.href = 'http://play.google.com/store/apps/details?id=com.truecaller&hl=en';
        }
        if(navigator.userAgent.toLowerCase().indexOf("iphone") > -1)
        {
            window.location.href = 'http://itunes.apple.com/lb/app/truecaller-caller-id-number/id448142450?mt=8';
        }
    }
</javascript>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

html javascript jquery android ios

20
推荐指数
1
解决办法
3万
查看次数

标签 统计

android ×1

html ×1

ios ×1

javascript ×1

jquery ×1