用JavaScript简单验证浏览器版本
摘自:脚本之家 原文地址http://www.jb51.net/article/15299.htm
有删节,有修正
是否为opera
<script>
is_opera = /opera/i.test(navigator.userAgent);
alert(is_opera);
</script>
[/javascript” line=”1″ escaped=”true]
是否是IE
<script>
is_opera = /opera/i.test(navigator.userAgent);
var is_ie = (/msie/i.test(navigator.userAgent) && !is_opera)
alert(is_ie);
</script>
[/javascript” line=”1″ escaped=”true]
是否为IE7
<script>
is_opera = /opera/i.test(navigator.userAgent);
var is_ie = (/msie/i.test(navigator.userAgent) && !is_opera)
alert(is_ie && /msie 7\.0/i.test(navigator.userAgent));
</script>
[/javascript” line=”1″ escaped=”true]
检测IE
<script>
if(document.uniqueID){
alert(“脚本在IE浏览器中运行!”);
}else{
alert(“脚本在非IE浏览器中运行!”);
}
</script>
[/javascript” line=”1″ escaped=”true]