Conditional Comments for Netscape 4

Test of Filter

This text will be green if the rule has been applied.

Code Syntax


<!--&{true};
   <style type="text/css">
   /*<![CDATA[*/ 
   #testElement {
      color: #00cc00;
      }
   /*]]>*/
   </style>
-->
         

Browser Support / Behaviour

Applied By

Not Applied By

Special Notes

Conditional comments were introduced in Netscape 4 to allow the inclusion of some HTML into a document if a condition is satisfied. All conditional comments have the following syntax:


<!--&{Javascript expression};
HTML content to parse if the condition is true goes here
-->
         

For our purposes, there is probably no reason to have any Javascript expression other than true (though you can have almost any valid Javascript expression you like).

By wrapping an embedded stylesheet in conditional comments, you can make the styles apply only to early versions of NS 4.x.

Support for condition comments seems to have disappeared somewhere between NS4.5 and NS4.7. And there is little documentation available on the web to even suggest that this technique ever existed, let alone why it's support disappeared on a point release.

More information