zoukankan      html  css  js  c++  java
  • h5 js判断是安卓还是ios设备,跳转到对应的下载地址

    /*ios和安卓跳转 js*/
    $(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") { //微信内置浏览器+应用宝链接
    $(".go").bind('touchstart', function (event) {
       //跳转到下载地址 这块我写的是安卓下载地址
    window.location.href='http://tstatics.iyuwan.com/files/apk/201605/Iyuwan.apk'
    });
    }else{
    if(isiOS){
    $(".go").bind('touchstart', function (event) {
                   //跳转到ios下载地址 
                    window.location.href='https://appsto.re/cn/KG6P2.i'

    });
    }else if(isAndroid){
    $(".go").bind('touchstart', function (event) {
    window.location.href='http://tstatics.iyuwan.com/files/apk/201605/Iyuwan.apk'
    });
    }else{ //PC 端
    $(".go").click(function(){
                    //跳转到andriod下载地址 
                    window.location.href='http://tstatics.iyuwan.com/files/apk/201605/Iyuwan.apk'
    });
    }

    }

    });
    Lyn小娜签名:聪明出于勤奋,天才在于积累。
  • 相关阅读:
    计算属性computed和watch侦听器
    .gitignore不起作用
    flex 布局
    vue-awesome-swiper
    Chrome截长屏
    JS 数组 foreach 和 map
    for-in 和 for
    边框画的三角形给shadow
    element-UI 表单图片判空验证问题
    Vue 表格内容根据后台返回状态位填充文字
  • 原文地址:https://www.cnblogs.com/lynna/p/6894960.html
Copyright © 2011-2022 走看看