js 判断浏览器UA
发布日期: 2020-12-24 00:00:00
点击次数: 1800
点击次数: 1800
大字
小字
const ua = navigator.userAgent
//浏览器环境判断
export let OS = (() => {
let isWeixin = /(?:micromessenger)/i.test(ua),
isAndroid = /(?:Android)/i.test(ua),
isIPhone = /(?:iPhone)/i.test(ua),
isiPad = /(?:iPad)/i.test(ua),
isPc = !isIPhone && !isAndroid
return
{
isWeixin,
isIOS: isiPad || isIPhone,
isAndroid,
isPc
}
})()