凌的博客

您现在的位置是:首页  > 前端学习 > Js

Js

js判断是否是手机端

2016-04-28Js0
//手机 function IsMobile() { var userAgentInfo = navigator.userAgent; var Agents = [\"Android\", \"iPhone\", \"SymbianOS\", \"Windows Phone\", \"iPad\", \"iPod\"]; var vIs = false; for (var i =
//手机
function IsMobile() {
    var userAgentInfo = navigator.userAgent;
    var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
    var vIs = false;
    for (var i = 0; i < Agents.length; i++) {
        if (userAgentInfo.indexOf(Agents[i]) > 0) {
            vIs = true;
            break;
        }
    }
    return vIs;
}

如果本文对您有所帮助,请支持下本站哦!!!^_^

文章评论

0条评论