js判断手机系统(Android或IOS),跳转相应下载地址

<script type="text/javascript">
$(document).ready(function(e) {
    var u = navigator.userAgent, app = navigator.appVersion;
    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    if(isAndroid == true){
        alert("这是Android手机")
        $("#go").attr("href","http://a.app.qq.com/o/simple.jsp?pkgname=com.xinchuang.chaofood ");
    }
    else if(isiOS == true){
        alert("这是IOS手机")
        $("#go").attr("href","https://appsto.re/cn/8Dur_.i");
    }
});
</script>

<script src="//cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>

<a href="#" id="go" date-id="5555">下载app</a>

 

posted on 2019-04-17 15:26  一只傻阿贝哟  阅读(274)  评论(0编辑  收藏  举报

导航