Newer
Older
iris_temperature_front_gz / src / utils / browser.js
StephanieGitHub on 12 Mar 2020 725 bytes first commit
export function isIE() {
  const userAgent = navigator.userAgent // 取得浏览器的userAgent字符串
  const isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1 // 判断是否IE<11浏览器
  const isEdge = userAgent.indexOf('Edge') > -1 && !isIE // 判断是否IE的Edge浏览器
  const isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf('rv:11.0') > -1
  if (isIE) {
    return true
  } else if (isEdge) {
    return false
  } else if (isIE11) {
    return true
  } else {
    return false
  }
}

export function isChrome() {
  const userAgent = navigator.userAgent
  if (userAgent.indexOf('Chrome') >= 0) {
    alert('Chrome')
    return true
  } else {
    return false
  }
}