mtjmtj7的小站
mtjmtj7的小站
© mtjmtj7
All Rights Reserved.

js判断是手机端或者PC

//判断是否是pc端
function IsPC() {
    var userAgentInfo = navigator.userAgent;
    var Agents = new Array("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;
}

 

打赏
2018-01-15
625 阅读
暂无评论

发表评论