The code is as follows:
<script> <br>(is_ie && /msie 7.0/ i.test(navigator.userAgent)); </div></script>
[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]
<script>
is_opera = /opera/i.test(navigator.userAgent);
alert(is_opera);
</script>[Ctrl A select all Note: <script>
is_opera = /opera/i.test(navigator.userAgent);
var is_ie = (/msie/i.test(navigator.userAgent) && !is_opera)
alert(is_ie);
</script>If you need to introduce external Js, you need to refresh to execute <script>
var isIe = /msie/i.test(navigator.userAgent);
alert(isIe);
</script>]<script>
if(document.uniqueID){
alert("脚本在IE浏览器中运行!");
}else{
alert("脚本在非IE浏览器中运行!");
}
</script> <script>
function Browser() {
var ua, s, i;
this.isIE = false; // Internet Explorer
this.isNS = false; // Netscape
this.version = null;
ua = navigator.userAgent;
s = "MSIE";
if ((i = ua.indexOf(s)) >= 0) {
this.isIE = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
// Treat any other "Gecko" browser as NS 6.1.
s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = 6.1;
return;
}
}
var browser = new Browser();
alert(browser);
</script>