js判断是否为移动端[Mobile]

function IsMobile() {
    var ua = navigator.userAgent;
    var ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
        isIphone = ua.match(/(iPhone\sOS)\s([\d_]+)/),
        isAndroid = ua.match(/(Android)\s+([\d.]+)/),
        isMobile = ipad || isIphone || isAndroid;
    return !!isMobile;
}

你可能感兴趣的:(原创,js,mobile,js判断移动端)