Skip to content

Instantly share code, notes, and snippets.

@benjamincharity
Created May 8, 2013 13:59
Show Gist options
  • Save benjamincharity/5540618 to your computer and use it in GitHub Desktop.
Save benjamincharity/5540618 to your computer and use it in GitHub Desktop.
// 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