JS判断手机操作系统(ios或android)并跳转到不同下载页面

//js判断是否移动端
$(function () {  
    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终端 
    if (isAndroid) {
        window.location.href = 'appDownload.html'; //Android
        } 
    if (isIOS) { 
    window.location.href = 'iosDownload.html'; } //IOS
});
//js判断是否电脑端
function IsPC() {  
    var userAgentInfo = navigator.userAgent; 
    var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; 
    var flag = true; for (var v = 0; v < Agents.length; v++) { 
        if (userAgentInfo.indexOf(Agents[v]) > 0) { 
            flag = false; break; 
    return flag; 
}
    原文作者:磊磊026
    原文地址: https://blog.csdn.net/qq_24318081/article/details/77326047
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞