Reputation: 101
Very new to web development, bear with me.
I want to check if the browser used is IE (all versions).
I need to change CSS if IE is detected.
Point me in right direction please.
Upvotes: 8
Views: 6148
Reputation: 6978
This is the JS I use
(function detectIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
var trident = ua.indexOf('Trident/');
var edge = ua.indexOf('Edge/');
if (msie > 0) {
// IE 10 or older
//Do some stuff
}
else if (trident > 0) {
// IE 11
//Do some stuff
}
else if (edge > 0) {
// Edge
//Do some stuff
}
else
// other browser
return false;
})();
Upvotes: 20
Reputation: 363
var configValues = getUserAgentValues();
var browserName = configValues.browser_name ;
var browserVersion = configValues.browser_vers;
var OSVersion = configValues.platform_type;
Please check this once.
Upvotes: -4