Answer
You can use Javascript to read the window.navigator
property and get the userAgent
from the resulting string like so:
var agent = window.navigator.userAgent;
if ( agent.indexOf('Trident') > -1 )
document.querySelector('body').classList.add('ie-css');
If you need versions
You can use UA Parser JS to get a nice object with all the details. This would be a "safer" approach than the above but you must include the library as well:
var parser = new UAParser(),
browser = parser.getBrowser();
console.log( browser.name, browser.major ); // -> "IE 10.0"
Caution
You might be aware of the this but using browser sniffing is an old and bad technique out in the wild. It leads to legacy and unmanageable code very quickly. Try and avoid detecting versions of IE.