[thelist] Javascript and HTTP caching with FireFox

Bill Moseley moseley at hank.org
Thu Mar 9 01:12:44 CST 2006


Firefox is always checking If-Modified-Since on javascript files,
even when instructed not to with cache-control and expires.


[08/Mar/2006:22:52:04 -0800] "GET /workshop/by/Webcast HTTP/1.1" 200 7868
[08/Mar/2006:22:52:04 -0800] "GET /js/behaviour.js HTTP/1.1" 304 0
[08/Mar/2006:22:52:04 -0800] "GET /js/style.js HTTP/1.1" 304 0
[08/Mar/2006:22:52:05 -0800] "GET /site/css/images/down_arror_gold.gif HTTP/1.1" 304 0
[08/Mar/2006:22:52:05 -0800] "GET /site/css/images/gray_bullet.png HTTP/1.1" 304 0

Here's the headers for that "behaviour.js" file:

    200 OK
    Cache-Control: max-age=86400
    Connection: close
    Date: Thu, 09 Mar 2006 06:32:41 GMT
    Server: Apache/1.3.33 (Unix) mod_fastcgi/2.4.2 mod_ssl/2.8.22 OpenSSL/0.9.7e
    Content-Length: 8659
    Content-Type: application/x-javascript
    Expires: Fri, 10 Mar 2006 06:32:41 GMT
    Last-Modified: Thu, 02 Feb 2006 04:54:50 GMT
    Client-Date: Thu, 09 Mar 2006 06:32:38 GMT


Any tricks I can do on the server end to get Firefox to not check until the
cache expires or an explicit reload?


It's also always checking those two css background images.  There's
other css background images that are not checked.  Yes, I've verified
the headers on all the requests.

A reload of the same page fetches:

[08/Mar/2006:23:02:39 -0800] "GET /workshop/by/Webcast HTTP/1.1" 200 7868
[08/Mar/2006:23:02:39 -0800] "GET /site/css/common.css HTTP/1.1" 304 0
[08/Mar/2006:23:02:39 -0800] "GET /site/css/style.css HTTP/1.1" 304 0
[08/Mar/2006:23:02:39 -0800] "GET /site/css/banner.css HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /js/behaviour.js HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /js/style.js HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /images/busy.gif HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /site/css/images/ifp_logo_sm.gif HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /site/css/images/gray_bullet.png HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /site/css/images/input_bg.gif HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /site/css/images/div_curve.gif HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /site/css/images/img_navarrowblue.gif HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /site/css/images/right_arror_blue.gif HTTP/1.1" 304 0
[08/Mar/2006:23:02:40 -0800] "GET /site/css/images/down_arror_gold.gif HTTP/1.1" 304 0

Every image other than the busy.gif is loaded as a css background
image.

I wonder why only these two are requested every request, and not the
last one below.  Here's the css where they are loaded:

#top-level li {
    background: url(images/right_arror_blue.gif) no-repeat 10px 50%;
    padding-left: 20px;
}

#top-level li.open {
    background: #eae9e0 url(images/down_arror_gold.gif) no-repeat 10px 3px;
}

Here's the ifp_logo_sm.gif:

#bannerTop {
    background-color: #bfd9f2;
    margin: 0px;
    height: 110px;
    background-image: url(images/ifp_logo_sm.gif);
    background-repeat: no-repeat;
}

Is it just weird FireFox 1.5 behavior?


-- 
Bill Moseley
moseley at hank.org




More information about the thelist mailing list