DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Cross Browser Compatibility Tip: Conditional Compile In IE

  • submit to reddit
Conditional Compilation of JScript/ JavaScript in IE

In IE, there is a little known feature called conditional compilation. Supported since IE4, this feature starting getting some attention when it began showing up in some Ajax related JavaScripts. An absolute form of object detection, conditional compilation lets you dictate to IE whether to compile certain parts of your JScript or JavaScript code depending on predefined and user defined conditions. Think of it as conditional comments for your script that can also be molded to work gracefully with non IE browsers as well.

Thanks to:

#48: Avatar kentaromiura / 19th April '06

You could do like I do here: <a hfef="">Crazy corners</a> using IE conditional comment
var cn=�class�;



so you use cn insted of class or classname _; bye


Cristian Carlesso replied on Fri, 2006/08/25 - 10:46am

I also use this method to insert a css file IE-only