Forum Moderators: not2easy

Message Too Old, No Replies

CSS Caching?

         

Emperor

7:26 pm on Jan 22, 2005 (gmt 0)

10+ Year Member



Hi guys,

If the browser caches an external CSS file and you change that file will the browser reload the new CSS file?

I remember in the old days I had to tell someone to delete their cache then refresh the document just for regular HTML pages (a simple refresh alone didn't do it).

Take care.

w3bch1ck

7:50 pm on Jan 22, 2005 (gmt 0)

10+ Year Member



It should do as in the head tags your coding should tell the browser where to retreive the css document from.

Also its not such a bad thing to regularly clear your cache anyway.

createErrorMsg

2:42 am on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the browser caches an external CSS file and you change that file will the browser reload the new CSS file?

I beleive not. This is, after all, one of the primary reasons to use an external stylesheet versus internal styles. If you've made changes to a css file that is linked to a live page, it's a good idea to change the filename (I use version numbers, as in styles_v1.css and styles_v2.css)and alter your <link> tags to match. This guarantees that all users to your site will, upon their next visit download and cache and the new CSS.

cEM

alias

6:06 am on Jan 23, 2005 (gmt 0)

10+ Year Member



By holding the Ctrl (Control) button and pressing the F5 key (or REFRESH with the mouse) your browser should reload the content as from scratch.
But as far as I've experimented - the CSS file is always being reloaded properly, even if it has the same filename.
A bigger problem can be with the Images, which my IE (v6.0) won't reload even if I hit CTRL+F5, so I have to clear the cache. The Firefox though hasn't such problems, the key combination works fine here.

createErrorMsg

4:10 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



your browser should reload the content

I believe the question referred to the visitors to the original posters site, not his own cached version of the CSS.

cEM

rocknbil

7:21 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the IE Internet general tab settings button is "every visit to the page" it should reload it whenever the page is refreshed. If it's not, the end use likely has it set to "automatic" which doesn't always pull in the changed copy.

A good fix I've found to avoid this (like most things in IE, sometimes works, sometimes doesn't) is to modify something near the top of the actual page, it seems like IE recognizes it as changed this way. At least more often. :-)