Last active
August 29, 2015 14:07
-
-
Save adamculpepper/10d3897c8e0f378a6d75 to your computer and use it in GitHub Desktop.
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
// Slightly modified version of Angular's method of checking for Internet Explorer (IE), including checking for IE11 | |
function detectIE() { | |
// check 6-10 | |
msie = parseInt((/msie (\d+)/.exec((navigator.userAgent).toLowerCase()) || [])[1]); | |
if (isNaN(msie)) { | |
// not 6-10, check 11 | |
msie = parseInt((/trident\/.*; rv:(\d+)/.exec((navigator.userAgent).toLowerCase()) || [])[1]); | |
} | |
// will be a number if IE or NaN if not | |
if (msie) { | |
$('body').addClass('ie ie' + msie); | |
alert('ie' + msie); | |
} | |
} | |
detectIE(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment