判断移动端的系统是Andriod还是IOS
2018-09-27 本文已影响4人
Lia代码猪崽
// 判断移动端的系统
detectSystem(){
let equipmentType = ''
const agent = navigator.userAgent.toLowerCase()
const android = agent.indexOf("android")
const iphone = agent.indexOf("iphone")
const ipad = agent.indexOf("ipad")
if(android !== -1){
equipmentType = "android"
}
if(iphone !== -1 || ipad !== -1){
equipmentType = "ios";
}
return equipmentType;
}