判斷是蘋果手機仍是安卓手機

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());
相關文章
相關標籤/搜索