this is a simple script use useragent to judge browser
Using npm:
$ npm install --save yu-judge-browser
$ import browser from 'yu-judge-browser'
console.log(browser)
{
"versions":{
"trident":false,
"presto":false,
"webKit":true,
"gecko":false,
"mobile":false,
"ios":false,
"android":false,
"iPhone":true,
"iPad":false,
"qq":false,
"wechat":false,
"webApp":false
},
"language":"zh-cn"
}"
* @returns {object[]} versions - true or false of different terminals
* @returns {boolean} [versions[].trident] - is ie ?
* @returns {boolean} [versions[].presto] - is opera ?
* @returns {boolean} [versions[].AppleWebKit] - is apple,chrome ?
* @returns {boolean} [versions[].gecko] - is firefox ?
* @returns {boolean} [versions[].mobile] - is mobile ?
* @returns {boolean} [versions[].ios] - is ios ?
* @returns {boolean} [versions[].android] - is android ?
* @returns {boolean} [versions[].iPhone] - is iPhone ?
* @returns {boolean} [versions[].iPad] - is iPad ?
* @returns {boolean} [versions[].qq] - is qq browser ?
* @returns {boolean} [versions[].wechat] - is wechat browser ?
* @returns {boolean} [versions[].webApp] - is webApp ?
* @returns {string} language - language of this web