| 7:28 pm on Jul 21, 2003 (gmt 0)|
Most of the time the cache isn't a problem. But I have seen it occur. So as a general rule everytime I update the CSS file I add a version number to it.
| 7:35 pm on Jul 21, 2003 (gmt 0)|
Thanks for the very prompt reply.
Just so I'm absolutely clear, do you mean you:
a) Change the file name from xyz003.css to xyz004.css; and
b) Change the href attribute in the HTML link tag from xyz003.css to xyz004.css?
| 7:49 pm on Jul 21, 2003 (gmt 0)|
That would work, since resources are cached by URL. If its a new URL, it can't have been previously-cached.
| 7:53 pm on Jul 21, 2003 (gmt 0)|
This is a very interesting question which had never occured to me. I mean the whole point of having external CSS is not having to mess with yll your files (ok, and avoiding repetition). So is there really no other way? Something like a special kind of nocache tag, only for included files?
| 8:04 pm on Jul 21, 2003 (gmt 0)|
You should make your CSS files cacheable, especially if they are shared by most or all of your pages.
When you need to change them, change their names. If you can't change their names, then set a short Expires header (like 30 minutes) for them via your server controls before you start developing changes. By the time you're ready to upload changes, most cached copies will have expired or will be set to expire shortly.
Realistically, it won't hurt to have them expire after a few hours as a normal practice. Shorter than that means more re-fetches, and longer than that means more likelihood of being stale if you change them often. It's all a trade-off.
We've got two threads going now... I posted a couple of useful links over here: [webmasterworld.com...]
| 8:42 pm on Jul 21, 2003 (gmt 0)|
Well if your calling your stylesheet from more than one page that could be a pain. So what I recommend is having an include to an HTML file. On that one html file would be the line calling the css file. That way you only have to change it in one file.
| 8:43 pm on Jul 21, 2003 (gmt 0)|
If the file size has changed since last usage the browser should download it again. I thought that was the default behaviour?
| 10:52 pm on Jul 21, 2003 (gmt 0)|
> the default behavior
True, but intervening caches may check Expires and provide the file locally. In the absence of a "strong" cache policy in the file header, the browser may get an old copy. The caching tutorial cited in the other thread [webmasterworld.com] covers this.