Thursday, April 07, 2011

Conditional compilation in IE

I normally know about conditional compilation of JS in IE using <!--[if gt IE 6] --> but here is something new I figured out today.

var IE;
//@cc_on IE = parseFloat(navigator.appVersion);

The best part here is that the JS code stays in your JS files and does not uglify the HTML if you ever have to use conditional compilation. Here is some more information about it from MSDN article Conditional Compilation (Windows Scripting - JScript).

No comments: