zoukankan      html  css  js  c++  java
  • 判断ios还是android

    $(function(){
        var u = navigator.userAgent;
        var ua = navigator.userAgent.toLowerCase();
        var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isiOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        if(ua.match(/MicroMessenger/i)=="micromessenger") {   //微信内置浏览器+应用宝链接
            $(".download a").bind('touchstart', function (event) {
                window.location.href='http://a.app.qq.com/o/simple.jsp?pkgname=应用名 '
            });
        }else{
            if(isiOS){
                $(".download a").bind('touchstart', function (event) {
                    window.location.href='https://itunes.apple.com/cn/app/应用名'
                     
                });
            }else if(isAndroid){
                $(".download a").bind('touchstart', function (event) {
                    window.location.href='http://a.app.qq.com/o/simple.jsp?pkgname=应用名'
                     
                });
            }else{  //PC 端
                $(".download a").click(function(){
                    window.location.href='应用链接'
                });
            }
         
        }
         
    });
  • 相关阅读:
    js中BOM和DOM的区别
    正则表达式
    第一个网页
    RegExp
    pseudoclasses&伪元素
    自我介绍
    DOM document 对象
    神经网络学习小节
    果然是神经网络
    果然是实践出真知啊
  • 原文地址:https://www.cnblogs.com/zhouyangla/p/5872494.html
Copyright © 2011-2022 走看看