js获取浏览器类型
getBrowser = () => { const userAgent = navigator.userAgent.toLowerCase(); let browser = null; (userAgent.indexOf('chrome') > -1 && userAgent.indexOf('safari') > -1) ? browser = 'chrome' : (userAgent.indexOf('firefox') > -1) ? browser = 'firefox' : (userAgent.indexOf('safari') > -1 && userAgent.indexOf('chrome') === -1) ? browser = 'safari' : (userAgent.indexOf('opera') > -1) ? browser = 'opera' : (userAgent.indexOf('compatible') > -1 && userAgent.indexOf('msie') > -1 && userAgent.indexOf('opera') <= -1) ? browser = 'ie' : (userAgent.indexOf('edge') > -1) ? browser = 'edge' : browser = 0; return browser; }
相关推荐
88274956 2020-11-03
Zhongmeishijue 2020-09-10
runner 2020-09-01
梦的天空 2020-08-25
IdeaElements 2020-08-19
luvhl 2020-08-17
移动开发与培训 2020-08-16
ReunionIsland 2020-08-16
lyqdanang 2020-08-16
NARUTOLUOLUO 2020-08-03
MyNameIsXiaoLai 2020-07-08
星辰的笔记 2020-07-04
csstpeixun 2020-06-28
letheashura 2020-06-26
liaoxuewu 2020-06-26
OldBowl 2020-06-26
北京老苏 2020-06-25
Luffyying 2020-06-25