美文网首页JavaScript
判断移动端的系统是Andriod还是IOS

判断移动端的系统是Andriod还是IOS

作者: Lia代码猪崽 | 来源:发表于2018-09-27 18:01 被阅读4次
// 判断移动端的系统
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;
}

参考资料

https://blog.csdn.net/qq_24147051/article/details/79131486

相关文章

网友评论

    本文标题:判断移动端的系统是Andriod还是IOS

    本文链接:https://www.haomeiwen.com/subject/hmqyoftx.html