I need to detect if the user is running an older version of IE (IE9 is fine) from a jQuery plugin, so I won't have control over the HTML.
We've been discouraged from parsing the user-agent string and using $.browser.msie
. The $.support
method doesn't cover the problem either.
So, I figured out that this works, but I'm not sure if it is "good practice".
$('body').append('<!--[if lte IE 8]><script>$("body").addClass("oldie");</script><![endif]-->');
var old_ie = $('body').is('.oldie');
Would you use this method or stick with parsing the user-agent string (I'll need to figure out if it's IE and get the version number)?