I think conditional comments are great for style sheets, but they can also be used for javascript / jquery.
Since .browser is deprecated and is now removed from jquery 1.9 (?) Using conditional comments, this is a pretty good way to make a javascript browser.
here is my quick example:
1 - Put a conditional comment somewhere on the page. I personally put it right after the body tag. I saw how people used it on the body itself or html, but this returns the IE8 / 9/10 comparability view button, and you want to avoid this if possible.
2 - then use jquery to check if our particular IE container exists.
if ($("div").hasClass("ie8-and-below")) { //do you JS for IE 8 and below only }
3 - (optional) set the target comparability and put something like:
<meta http-equiv="X-UA-Compatible" content="IE=10" />
immediately after the <head> . (this should be the very first after opening <head> ). This will disable the compatibility button in ie10 / 9/8 if the rest of your page is correctly encoded. This is a good glitch if you have partitions that require compatibility mode, other ways to start JS when starting a newer browser in compatibility.
Note. At the time of publication of this post, http-equiv does not confirm the W3C standards, but it is a very useful tag that has been adopted by google and microsoft home pages among others. I think this is only because the W3C is slightly behind its adoption.
source share