Conditional Complication Presented By Prosunjit Biswas Email: firstname.lastname@example.org System Developer, Cention AB, Bangladesh.
What is Conditional Compilation? CC is special JS codes for IE that will be ignored by other browser than IE
Introducing CC ( CC tricks ) difference between this two JS codes /* alert('this is commented '); */ /*@ alert(' this is not commented in IE but commented in other browser '); @*/
Tricking Other browsers So, If you write any code inside /*@ ...... @*/ it will be commented to all other browsers than IE
Getting smarter Lets make the code graceful /* @cc_on -------------------> start Tag //code goes here @*/ --------------------> end tag
Hello World Example /* @cc_on alert('Will be shown only in IE'); @*/ /* @cc_on @if ( @_win32 ) alert(' 32 bit Windows'); @else alert('Not 32 bit windows system'); @*/
Boiling water to make COFFEE Implementing browser Specific job / * @cc_on /*@ if (@_jscript_version >= 5 ) alert('IE with Support 5+'); @elif (@_jscript_version >= 4 ) alert('IE with Support 4+'); @else @*/ alert('Non IE Browser'); /*@end @*/