ua 判断 当前是 mac,windows,android,ipad,ios

直接记录代码

    const ua = navigator.userAgent
    function getType(){
        if (ua.match(/iPhone OS|iPad/i)) {
            return "ios"
        } else if (ua.match(/Android/)) {
            return "android"
        } if (ua.match(/Mac OS X/i)) {
            return "mac"
        } else {
            return "win"
        }
    }

你可能感兴趣的:(ua 判断 当前是 mac,windows,android,ipad,ios)