js 根据userAgent 判断安卓,ios,windows 系统

180it 2020-12-10 AM 224℃ 0条
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>


$(function () {

    //判断是安卓还是ios
          var u = navigator.userAgent, app = navigator.appVersion;
        var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        var iswindows = u.indexOf('Windows NT') > -1 || u.indexOf('Windows NT') > -1; //g

document.write(u+'<br/>');
document.write("iswindows "+iswindows +'<br/>' );
document.write("isAndroid "+isAndroid+'<br/>' );
document.write("isIOS  "+isIOS+'<br/>' );

        if (isAndroid) {
           location.href = 'http://www.xxxx.cn/down/zy.apk';
      
        }else if (isIOS) {
        //这个是ios操作系统
    
       
          window.open('https://apps.apple.com/');
        }else{
//document.write("windows 系统"+'<br/>' );
        }
      
    });

</script>
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

js 根据userAgent 判断安卓,ios,windows 系统