Return major version of IE.
Code directly taken from AngularJS: http://bnj.bz/2h2f2n3z3N2O
I just thought it was worth sharing...
// 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'
Written by Benjamin Charity
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ie
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#