views:

71

answers:

3

Hi,

I uploaded my web application already in my Production Tomcat Web Server.
I am trying to test it already and it works fine on FF/IE7/IE8 but I am having a problem on display on IE6.

I notice in the status bar that IE6 seems to be downloading the images every now and then. Even though I did not click anything, it still downloads the images.

I am using a menu that uses images and it does not display well on IE6. Problem is that 60% of my targeted user runs on this browser.

I am beginning to think that this is a browser cache problem. In all my JSP, I place below meta tag in all the head section. I did this because my apps relies heavily on Ajax and I need the latest copy of my web resource.

<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">
</head>

Could this be the culprit and is there any workaround for this? How can I force IE6 to cache those images? Thanks.

I am not exactly sure if this is what you are looking for but kindly advise if I miss anything.

This is an example of an Image being downloaded. I forgot to mention that this apps runs only on our local intranet web site.

@Pekka, Is this what you are looking for?

Response Headers
Server  Apache-Coyote/1.1
Etag    W/"1957-1275442082000"
Date    Mon, 18 Oct 2010 11:37:00 GMT

Request Headers
Host    atpapps03:9090
User-Agent  Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 ( .NET CLR 3.5.30729)
Accept  image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive  115
Connection  keep-alive
Referer http://atpapps03:9090/rts/css/menu.css
Cookie  JSESSIONID=0DD210EE0B2788A7774B10D477734DA9
If-Modified-Since   Wed, 02 Jun 2010 01:28:02 GMT
If-None-Match   W/"1957-1275442082000"
Cache-Control   max-age=0
+1  A: 

see e.g. this question on how to control the caching settings for static file types.

Pekka
@Pekka I posted above a sample of an image file from a Jquery UI Image. Is this what you are looking?
Mark Estrada
@Mark yup. You need to change the server side settings for caching
Pekka
@Pekka. Thanks. I will check out on this although I honestly dont have an idea yet on how to do this. I will ask for advise as I am still a beginner on Spring MVC
Mark Estrada
You might have overlooked that his "Cache-Control" header was on the request, not the response. That's because he refreshed this page while doing the network capture. But the general advice is correct-- you need to set a freshness lifetime on this image. See http://www.fiddler2.com/redir/?id=httpperf
EricLaw -MSFT-
Why would it be? That header is been set on the request, not on the response...
BalusC
@BalusC @Eric (facepalm) of course. I must have been asleep. Cheers, I'll remove that bit
Pekka
A: 

Pekka is correct, its likely the caching control. A way around this would be to load your images from a different subdomain with a different set of cache headers. If you use a CDN provider, they will set the cache control for you.

IE SUCKS! id test it on IE 7-8-9. Very few use IE6 if its an intranet app, a quick fix would be Chrome frame, detect it, and if its not installed redirect to a download page.

franky b
+2  A: 

In all my JSP, I place below meta tag in all the head section. I did this because my apps relies heavily on Ajax and I need the latest copy of my web resource.

There are two problems:

  1. The meta tags are ignored by the webbrowser. Put this information in the response header.

  2. Even when it wasn't ignored, the meta rules would only apply on the HTML output of the JSP and thus not on all linked resources (img, js, css, etc) inside the HTML output. They have each their own rules in their own response header.

Your best bet is using a Filter which adds the Expires header on a far-future date on static content.

private static final long DEFAULT_EXPIRE_TIME = 604800000L; // ..ms = 1 week.

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
    final long twoWeeksAhead = System.currentTimeMillis() + DEFAULT_EXPIRE_TIME;
    ((HttpServletResponse) response).setDateHeader("Expires", twoWeeksAhead);
    chain.doFilter(request, response);
}

Map this filter in web.xml on an url-pattern covering the URL of interest, e.g. /images/*.

BalusC
+1 for specific advice
Pekka
@Balusc Thanks. YSLOW grade for Expire now is A and I am seeing a considerable Load Time Speed Now in IE6. Thanks thanks!
Mark Estrada
@Balusc On one thing, do you have an idea why only IE6 exhibits this kind of behavior? Why IE7/IE8/FF is doing fine..
Mark Estrada