Javascript IE detection, why not use simple conditional comments? [duplicate]
问题 This question already has answers here : Check if user is using IE (29 answers) Closed 14 days ago . In order to detect IE most Javascript libaries do all sort of tricks. jQuery seem to add a temporary object into your pages's DOM to detect some features, YUI2 does regex on the user agent in its YAHOO.env.ua = function() (file yahoo.js ) After reading this answer it came in my mind that it's true, in order to detect simply IE in Javascript we could simply add to our pages: <!--[if IE]><script