Steve - thanks a lot, this is a very clean and nice solution to this issue.
Very nice !

Cheers,

Alex K

On Sun, Aug 12, 2012 at 5:34 AM, Steve Eynon <[email protected]
> wrote:

> I use this little component:
>
> import org.apache.tapestry5.MarkupWriter;
> import org.apache.tapestry5.annotations.Parameter;
>
> public class IfIe {
>
>     @Parameter(required=true, defaultPrefix="literal")
>     private String test;
>
>     public void beginRender(MarkupWriter writer) {
>         // write out a dummy tag to prevent T5 from writing it's
> script tags 'inside' the IE comment!
>         writer.element("script", "type", "text/javascript");
>         writer.end();
>
>         writer.writeRaw("\n<!--[if ");
>         writer.writeRaw(test);
>         writer.writeRaw("]>\n");
>     }
>
>     public void afterRender(MarkupWriter writer) {
>         writer.writeRaw("\n<![endif]-->\n");
>     }
> }
>
> <html>
> <head>
>     <title>Feel The Pain</title>
>     <t:ifIe test="lt IE 9">
>         <script type="text/javascript"
> src="${asset:context:/javascript/html5shiv-rc1.js}"></script>
>     </t:ifIe>
> </head>
>   ...
>
> --
> Steve Eynon
> -------------------------------
> "If at first you don't succeed,
>    so much for skydiving!"
>
>
>
> On 19 July 2012 09:10, Alex Kotchnev <[email protected]> wrote:
> > I'll give George's suggestion a go tomorrow. It seems like I should be
> able
> > to do this from the layout components that pages use, so that I don't
> have
> > to add the code to each page.
> >
> > Cheers,
> >
> > Alex K
> > On Wed, Jul 18, 2012 at 4:51 PM, trsvax <[email protected]> wrote:
> >
> >> For this particular case I suspect you just want this on every page in
> the
> >> site.
> >>
> >> If so the simplest way would be just include the following in your
> >> layout.tml file
> >>
> >> &lt;!--[if lt IE 9]&gt;
> >>
> >>  &lt;![endif]--&gt;
> >>
> >> --
> >> View this message in context:
> >>
> http://tapestry.1045711.n5.nabble.com/Conditionally-IE-including-javascript-tp5714506p5714581.html
> >> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to