判断是苹果手机还是安卓手机

function isIos(){
    var equipmentType = "";
    var agent = navigator.userAgent.toLowerCase();
    var android = agent.indexOf("android");
    var iphone = agent.indexOf("iphone");
    var ipad = agent.indexOf("ipad");
    if(android != -1){
        equipmentType = false;
    }
    if(iphone != -1 || ipad != -1){
        equipmentType = true;
    }
    return equipmentType;
}
alert(isIos());

猜你喜欢

转载自www.cnblogs.com/xlj-code/p/10368285.html