The User-Agent header is very unreliable (unless this is for an intranet) and you would also need to add "Vary: User-Agent" to defeat caching by shared proxies.

It's probably better to use two stacks instead, and include the IE stack with a conditional comment. For example, I use this "IERepair" component to add ifixpng for <=IE6 and selectivizr/css3pie for <=IE8 :


public class IERepair
{
        @Inject
        private JavaScriptStackPathConstructor stackPathConstructor;

        boolean beginRender(MarkupWriter writer)
        {
                writer.writeRaw("<!--[if lte IE 6]>");
                renderStack(writer, IE6_STACK);
                writer.writeRaw("<![endif]-->");

                writer.writeRaw("<!--[if lte IE 8]>");
                renderStack(writer, IE8_STACK);
                writer.writeRaw("<![endif]-->");

                return false;
        }

        private void renderStack(MarkupWriter writer, String stack)
        {
List<String> paths = stackPathConstructor.constructPathsForJavaScriptStack(stack);
                for (String path : paths)
                {
                        writer.element("script", "type", "text/javascript", 
"src", path);
                        writer.end();
                }
        }
}


On Sun, 09 Oct 2011 12:40:52 +0200, François Facon <francois.fa...@atos.net> wrote:

Hi Dimitris,

Perphas a perThread service could detect with the useragent header if
the browser used by the client is IE. by injecting this service to
stack, you could use it to verify if you have to  add the js when the
method getJavaScriptLibraries get called .

Regards
François

2011/10/9 Dimitris Zenios <dimitris.zen...@gmail.com>:
Hi guys.I have a javascript stack which includes two javascript files.
One should be always added and the other only when internet explorer.
Is there a possibility to append the internet explorer javascript file
only when needed or it should be always added?

Dimitris Zenios

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to