Javascript checks whether it is ie or a specific version. There are many methods and whether the regular code comparison section is Opera:
Script is_opera =/opera/I. test (navigator. userAgent); alert (is_opera); script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Whether it is IE:
Script is_opera =/opera/I. test (navigator. userAgent); var is_ie = (/msie/I. test (navigator. userAgent )&&! Is_opera) alert (is_ie); script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Whether it is ie7:
The Code is as follows:
Script
(Is_ie &/msie 7 \. 0/I. test (navigator. userAgent ));
Script
Script var isIe =/msie/I. test (navigator. userAgent); alert (isIe); script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Script if (document. uniqueID) {alert ("the script runs in IE browser! ");} Else {alert (" the script runs in a non-IE browser! ");} Script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Determine the ie version using javascript
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
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]