-
1. Re: How do I output a HTML comment in the head-tag via heade
theute Oct 10, 2006 8:34 AM (in response to wa7son)Not sure what you aretrying to do but did you try surrounding it with CDATA ?
<![CDATA[ <!--[if lt IE 7.]> <script src="/javascripts/pngfix.js" type="text/javascript">// foobar</script> <![endif]--> ]]>
-
2. Re: How do I output a HTML comment in the head-tag via heade
wa7son Oct 10, 2006 9:22 AM (in response to wa7son)"thomas.heute@jboss.com" wrote:
Not sure what you aretrying to do but did you try surrounding it with CDATA ?
Yes... In that case it is not injected to the head tag at all.
I tried two ways, both of which did not work:<![CDATA[<!--[if lt IE 7.]>]]> <script src="/javascripts/pngfix.js" type="text/javascript" defer="defer">// foobar</script> <![CDATA[<![endif]-->]]>
and as you suggested:<![CDATA[ <!--[if lt IE 7.]> <script src="/javascripts/pngfix.js" type="text/javascript" defer="defer">// foobar</script> <![endif]--> ]]>
What I am trying to achive is to insert what is called "conditional comments", but the problem is basically to insert any HTML comment at all.
For more info on conditional comments see:
http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp
http://virtuelvis.com/archives/2004/02/css-ie-only -
3. Re: How do I output a HTML comment in the head-tag via heade
wa7son Oct 10, 2006 9:27 AM (in response to wa7son)Btw... This is the complete jboss-portlet.xml file:
<portlet-app> <portlet> <portlet-name>ProductionUnitPortlet</portlet-name> <remotable>true</remotable> <header-content> <link href="/stylesheets/eogs.css" title="" rel="stylesheet" type="text/css" media="screen" /> <link href="/stylesheets/calendar/calendar-win2k-1.css" title="calendar-win2k-1" rel="stylesheet" type="text/css" media="all" /> <script src="/javascripts/popup.js" type="text/javascript" defer="defer">// foobar</script> <![CDATA[ <!--[if lt IE 7.]> <script src="/javascripts/pngfix.js" type="text/javascript" defer="defer">// foobar</script> <![endif]--> ]]> </header-content> <security></security> <!-- <transaction> <trans-attribute>Required</trans-attribute> </transaction> --> </portlet> </portlet-app>
-
4. Re: How do I output a HTML comment in the head-tag via heade
mholzner Oct 10, 2006 9:48 AM (in response to wa7son)In your case the code is ignored because the xml descriptor is parsed in a standard way (i.e. ignoring comments).
BUT: You can do it via code. In the portlet's doView() etc. you can inject any HTML you want. Look for the ContentRewritePortlet in the portlet examples (in core).response.setProperty("HEADER_CONTENT", "<your string here>");
You can even wsrp rewrite the content to get namespacing:res.setProperty("WSRP_REWRITE", "true");
-
5. Re: How do I output a HTML comment in the head-tag via heade
wa7son Oct 18, 2006 7:58 AM (in response to wa7son)As far as I can see this is not possible for me because I'm using MyFaces (and it is MyFaces who control the portlet).
My guess is that MyFaces is doing the exact same thing as you are describing, but for some reason, the MyFaces portlet does not get the complete content <header-content> tag. Could it be that some of the content accidentally was filtered / escaped away and therefore lost before added to the HEADER_CONTENT property? -
6. Re: How do I output a HTML comment in the head-tag via heade
mholzner Oct 18, 2006 2:24 PM (in response to wa7son)Currently it is not possible to get what you want via the descriptor.
Look atorg.jboss.portal.theme.deployment.jboss.PortalThemeMetaDataFactory
That's where the descriptor gets unmarshalled. As you can see there, everything but script and link tags will be ignored.
Not sure if you could modify your script to be cross browser.