Created
May 8, 2013 13:59
-
-
Save benjamincharity/5540618 to your computer and use it in GitHub Desktop.
Return the major version of IE. Code stolen from AngularJS: http://www.explainjs.com/explain?src=http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.js
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
// define a couple of functions to make things a bit cleaner | |
var lowercase = function(string){ | |
return isString(string) ? string.toLowerCase() : string; | |
}; | |
function isString(value){ | |
return typeof value == 'string'; | |
} | |
// test for the major version of IE | |
var msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]); | |
// Results will return a simple integer, e.g. '10' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment