Detecting IE with JS conditional comments
var isMSIE = /*@cc_on!@*/false;
var ieScript/*@cc_on=@_jscript_version@*/; if (ieScript) // IE if (ieScript>=5.5) // IE 5.5 + if (ieScript==5.7) // IE 7.0 VistaCopy to clipboard
Moreover Dean also shows in one of the comments how to check for the rendering path used by IE (quirks VS strict modes)
var ieStrict = document.compatMode == 'CSS1Compat';Copy to clipboard
While is not very wise to abuse the sniffing of browsers vendors it’s also true that sometimes it’s required to split the code path in order to support the incompatibilities among browser vendors and versions.