How to use conditional stylesheets or javascript with JSF


A annoying part of JSF is that it will strip out all of your conditional statements. These conditional references are needed for IE bug fixes 99% of the time. The solution is a simple hack using the outputText component. This will treat the html entities as strings and convert them.

For example this outputText will render the html5shiv cdn.

value="&lt;!--[if lte IE 8]&gt;
&lt;script src=&quot;//;&gt;&lt;/script&gt;
escape="false" />


<!--[if lte IE 8]>
  <script src="//"></script>

Now once rendered the browser will be able to correctly interpret your conditional statements.