<script> window["MzBrowser"]={};(function() { if(MzBrowser.platform) return; var ua = window.navigator.userAgent; MzBrowser.platform = window.navigator.platform; MzBrowser.firefox = ua.indexOf("Firefox")>0; MzBrowser.opera = typeof(window.opera)=="object"; MzBrowser.ie = !MzBrowser.opera && ua.indexOf("MSIE")>0; MzBrowser.mozilla = window.navigator.product == "Gecko"; MzBrowser.netscape= window.navigator.vendor=="Netscape"; MzBrowser.safari= ua.indexOf("Safari")>-1; if(MzBrowser.firefox) var re = /Firefox(\s|\/)(\d+(\.\d+)?)/; else if(MzBrowser.ie) var re = /MSIE( )(\d+(\.\d+)?)/; else if(MzBrowser.opera) var re = /Opera(\s|\/)(\d+(\.\d+)?)/; else if(MzBrowser.netscape) var re = /Netscape(\s|\/)(\d+(\.\d+)?)/; else if(MzBrowser.safari) var re = /Version(\/)(\d+(\.\d+)?)/; else if(MzBrowser.mozilla) var re = /rv(\:)(\d+(\.\d+)?)/; if("undefined"!=typeof(re)&&re.test(ua)) MzBrowser.version = parseFloat(RegExp.$2); })(); function aa() { if(MzBrowser.ie&&MzBrowser.version==8) { window.location.href = "./error/coe_not_support.htm"; } } aa(); </script>
javascript判断浏览器类型,布布扣,bubuko.com
原文:http://blog.csdn.net/jokewang5199/article/details/26245115