CSS

js 判断客户端

2019-12-06  本文已影响0人  草帽lufei

使用 navigator.userAgent

let userAgentInfo = navigator.userAgent
let agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod', 'iOS']
let isPC = null
agents.forEach((item) => {
  if (userAgentInfo.indexOf(item) > 0) {
    isPC = false
    return false
  }
})
console.log(isPC)
上一篇 下一篇

猜你喜欢

热点阅读