测试是否是移动端,是否是iphone,是否是安卓

function isMobile(){
    return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}
function isIphone(){
    return /iphone/gi.test(navigator.userAgent);
}
function isAndroid(){
    return /Android/gi.test(navigator.userAgent);
}
function isIphoneX(){
    var isIphone=/iphone/gi.test(navigator.userAgent);
    if(isIphone&& (screen.height == 812 && screen.width == 375)){
        return true;
    }else{
        return false;
    }
}

猜你喜欢

转载自www.cnblogs.com/yycc11/p/9088355.html