Last active
August 29, 2015 14:19
-
-
Save franklinjavier/d883dc145c11f4725c86 to your computer and use it in GitHub Desktop.
Detect IE version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Detect if the browser is an IE | |
| * | |
| * @return int | |
| */ | |
| var isie = (function() { | |
| return navigator.appName.toLowerCase() === 'microsoft internet explorer'; | |
| }()); | |
| /** | |
| * Detect the version | |
| * | |
| * @return int | |
| */ | |
| var version = (function() { | |
| var rv = false; | |
| if (isie) { | |
| var ua = navigator.userAgent; | |
| if (/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(ua) !== null) { | |
| rv = parseFloat(RegExp.$1); | |
| } | |
| } | |
| return rv; | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment