1,检测IE浏览器版本的方法1
<script type="text/javascript"> //检测浏览器版本 //by www.jb200.com var browser=navigator.appName var b_version=navigator.appVersion var version=b_version.split(";"); var trim_Version=version[1].replace(/[ ]/g,""); if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0") { alert("IE 6.0"); } else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0") { alert("IE 7.0"); window.location.href="http://xxxx.com"; } else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE8.0") { alert("IE 8.0"); } else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE9.0") { alert("IE 9.0"); } </script>
2,检测浏览器版本的方法2
<script type="text/javascript"> //检测浏览器版本 //by www.jb200.com if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion .split(";")[1].replace(/[ ]/g,"")=="MSIE6.0") { alert("IE 6.0"); } else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion .split(";")[1].replace(/[ ]/g,"")=="MSIE7.0") { alert("IE 7.0"); } else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion .split(";")[1].replace(/[ ]/g,"")=="MSIE8.0") { alert("IE 8.0"); } else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion .split(";")[1].replace(/[ ]/g,"")=="MSIE9.0") { alert("IE 9.0"); } </script>
3,检测浏览器版本类型的方法3
<script type="text/javascript"> //检测浏览器版本 //by www.jb200.com if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/7./i)=="7.") { alert("IE 7.0"); } else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/8./i)=="8.") { alert("IE 8.0"); } else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i)=="9.") { alert("IE 9.0"); } else if(navigator.appName == "Microsoft Internet Explorer") { alert("IE 6.0"); } </script>