AnsweredAssumed Answered

caching issues

Question asked by netos on Mar 9, 2008
Hi all.

I am trying to prevent caching in explorer and firefox since i have an action where i update the thumbnails of pictures and this change requires clearing the cache to see the affect.

i have tried to use META tags in like this:

            String userAgent = ((HttpServletRequest)pageContext.getRequest()).getHeader("user-agent");
               out.write("<META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache, no-store, must-revalidate\">");
               out.write("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
               out.write("<META HTTP-EQUIV=\"Expires\" CONTENT=\"-1\">");
               out.write("<meta http-equiv=\"Cache-control\" content=\"no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0, max-age=0\">");
               out.write("<meta http-equiv=\"Pragma\" content=\"no-cache\">");
               out.write("<meta http-equiv=\"Expires\" content=\"Sat, 01 Aug 1981 08:28:00 GMT\">");
               out.write("<meta http-equiv=\"Keep-Alive\" content=\"timeout=3, max=993\">");

this is the best i could come up with following a search on the differences between IE and firefox. it doesn't work in both of them…
next thing i read is that META tags are unreliable anyways…

so if anyone can please shed some light it would be great, and my next step is to add the headers to the response and not as META tags, so if anyone can direct me to the correct place in the correct servlet it would be nice….