JS如何判断IE和火狐与Chrome浏览器

var isIE=navigator.userAgent.toUpperCase().indexOf("MSIE")?true:false; 

var isFirefox=navigator.userAgent.toUpperCase().indexOf("Firefox")?true:false;

var isChrome = window.navigator.userAgent.indexOf("Chrome") !== -1

例:
var isIE=navigator.userAgent.toUpperCase().indexOf("MSIE")==-1?false:true;
if(isIE) document.getElementById("abc").style.display="";
原文地址:https://www.cnblogs.com/hailexuexi/p/4704117.html