jsf 2 - Browser-dependent CSS switch with JSF -


i need browser specific css in jsf2 application (mojarra 2.1, tomcat 7).

i tried adding template:

    <!--[if ie 8]>         <link rel="stylesheet" type="text/css" href="#{cfgs.externalcssurlie8}" />     <![endif]--> 

but comments not rendered since use:

<context-param>     <!-- removes comments rendered html pages. -->     <param-name>javax.faces.facelets_skip_comments</param-name>     <param-value>true</param-value> </context-param> 

my problem... when disable `javax.faces.facelets_skip_comments, bunch of other problems.. don't think source-code comments belong generated pages.

i tried put switch in cdata like:

<![cdata[  <!--[if ie 7]>         <link rel="stylesheet" type="text/css" href="#{cfgs.externalcssurlie7}" />  <![endif]--> ]]> 

but inner < rendered html entities.. :-/, not working.

question: there other solution? jsf2 tag exist handle this? external tag libraries?

thanks in advance, steve

the way using <h:outputtext escape="false">.

<h:outputtext value="&lt;!--[if ie 8]&gt;&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;#{cfgs.externalcssurlie8}&quot; /&gt;&lt;![endif]--&gt;" escape="false" /> 

yes, line of ugliness. there's no other standard way.


update: jsf utility library omnifaces offers <o:conditionalcomment> purpose don't need ugly <h:outputtext escape="false"> anymore:

<o:conditionalcomment if="ie 8">     <link rel="stylesheet" type="text/css" href="#{cfgs.externalcssurlie8}" /> </o:conditionalcomment> 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -