benjamincharity
5/8/2013 - 1:59 PM

Return the major version of IE. Code stolen from AngularJS: http://www.explainjs.com/explain?src=http://ajax.googleapis.com/ajax/libs/angula

// 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'