JS判断浏览器 function fuGetNavigatorInfo() { var ua = navigator.userAgent, type; if(ua.indexOf("MSIE 6.0") > -1) { type = "IE6"; } else if (ua.indexOf("MSIE 7.0") > -1) { type = "IE7"; } else if (ua.indexOf("MSIE 8.0") > -1) { type = "IE8"; } else if (ua.indexOf("Firefox") > -1) { type = "Firefox"; } else if (ua.indexOf("Chrome") > -1) { type = "Chrome"; } else if (ua.indexOf("Safari") > -1 && ua.indexOf("Chrome") == -1) { type = "Safari"; } else if (ua.indexOf("Opera") > -1) { type = "Opera"; } else { type = "Others"; }; //alert("您使用的浏览器:"+type+"; 分辨率:"+window.screen.width+"X"+window.screen.height); return type; }; var test = fuGetNavigatorInfo(); 作者:深潭 出处:http://www.cnblogs.com/dbasys/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。