Created
May 28, 2016 05:34
-
-
Save stewhouston/bf8ab67e0adc64b15e208ce12809c1e8 to your computer and use it in GitHub Desktop.
Detect Internet Explorer/Edge with JavaScript userAgent string sniffing. Silly spoofers.
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
var isIE = (function() { | |
var ua = navigator.userAgent, | |
ieMatches = [/Edge\/[0-9\.]+$/, /MSIE/, /Trident\/[0-9\.]+/]; | |
for(var i = 0, len = ieMatches.length; i < len; i++) { | |
if (ua.match(ieMatches[i])) { | |
return true; | |
} | |
} | |
return false; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment