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

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());

 

posted @ 2019-02-13 10:00  asimpleday  阅读(860)  评论(0编辑  收藏  举报