简单明了区分IE,Firefox,chrome主流浏览器

简单明了判断浏览器
Firefox:
typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;

chrome

typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

IE10 及之前

typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('ie') > -1;

IE11
typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('trident') > -1;

猜你喜欢

转载自www.cnblogs.com/hill-foryou/p/9835747.html