Guest User

Untitled

a guest
Oct 17th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. /**
  2. * @returns {String} 当前浏览器名称
  3. */
  4. export const getExplorer = () => {
  5. const ua = window.navigator.userAgent
  6. const isExplorer = (exp) => {
  7. return ua.indexOf(exp) > -1
  8. }
  9. if (isExplorer('MSIE')) return 'IE'
  10. else if (isExplorer('Firefox')) return 'Firefox'
  11. else if (isExplorer('Chrome')) return 'Chrome'
  12. else if (isExplorer('Opera')) return 'Opera'
  13. else if (isExplorer('Safari')) return 'Safari'
  14. }
Add Comment
Please, Sign In to add comment