This seems to work for me in most cases

Dynamically load your CSS file with a random query string (if you are  
scripting).
It makes your browser think its a different file.

PHP Example: (sorry i don't know ASP, JSP etc.
<?php
$randbuilder = md5(rand(time(), 10));
?>
        <link href="/assets/css/styles-site.css?id=<?=$randbuilder;?>"  
rel="stylesheet" type="text/css" />

This was an old trick from the IE4 days, how we got around people  
caching .swf movies

Phil
MacSoftReview.com



On Feb 16, 2006, at 2:02 PM, Bill Moseley wrote:

> On Thu, Feb 16, 2006 at 04:22:46PM +0000, James MacLeod wrote:
>>>>> Is there any trick to get IE 5.2 Mac to reload *all* files  
>>>>> short of
>>>>> clearing it's cache?
>>
>> As well as setting the cache preferences to 0/always refresh, I've
>> gotten into the habit of holding down Shift + Command + Alt when
>> reloading. Not official, bu seems to do the trick for CSS files, at
>> least.
>
> Unfortunately, that doesn't work on the version of IE I'm using.  No
> command combination seems to change the behavior of the way IE
> "reloads".
>
> Of course, this is a caching issue.  If the server tells the browser
> that's it's ok to cache a file for some amount of time then, well,
> it's well within its "rights" to not fetch that again until that time
> has expired.  Makes testing a pain, unless you can control those
> headers or you use something nice like Firefox where you can force it
> to reload.
>
> That was my solution -- I just set my server to send no-cache headers
> on all my files while testing.
>
>
> So, Firefox doesn't re-request a page that is cached unless you hit
> reload.  Reload in Firefox does force a reload for the page you are
> viewing, but for loaded pages (e.g. css files and images) Firefox  
> sends
> a request with the If-Modified-Since header.
>
> Here's an example for http://bumby:3000/index.html.
>
> *All* files returned by the server say it's ok to cache the file for a
> day.  So after the initial page load just going back to http:// 
> bumby:3000/index.html
> does NOT make another request to the server.  Firefox just displays
> what's in it's cache just like it should.
>
> Hitting the reload button (or shift-R or F5) results in these  
> requests:
>
>     http://bumby:3000/index.html  -- 200
>     http://bumby:3000/site/css/common.css  -- 304
>     http://bumby:3000/site/css/style.css  -- 304
>     http://bumby:3000/site/css/banner.css  -- 304
>     http://bumby:3000/images/busy.gif  -- 304
>     http://bumby:3000/site/css/images/ifp_logo_sm.gif  -- 304
>     http://bumby:3000/site/css/images/input_bg.gif  -- 304
>     http://bumby:3000/site/css/images/img_navarrowblue.gif  -- 304
>     http://bumby:3000/site/css/images/div_curve.gif  -- 304
>     http://bumby:3000/site/css/images/right_arror_blue.gif  -- 304
>
> So reload always reloads the current page, but not the other pages.
> Of course, if any of those had changed then the server would return
> those instead returning the 304.
>
> But hitting the reload button while holding down the shift button
> forces reload of all files:
>
>     http://bumby:3000/index.html  -- 200
>     http://bumby:3000/site/css/common.css  -- 200
>     http://bumby:3000/site/css/style.css  -- 200
>     http://bumby:3000/site/css/banner.css  -- 200
>     http://bumby:3000/images/busy.gif  -- 200
>     http://bumby:3000/site/css/images/ifp_logo_sm.gif  -- 200
>     http://bumby:3000/site/css/images/input_bg.gif  -- 200
>     http://bumby:3000/site/css/images/img_navarrowblue.gif  -- 200
>     http://bumby:3000/site/css/images/div_curve.gif  -- 200
>     http://bumby:3000/site/css/images/right_arror_blue.gif  -- 200
>
> Again, Shift-reload isn't really needed since any changes to the
> loaded files would be noticed and return 200 instead of 304.  So if
> you update a css file then reload should be fine.
>
> Note that if that index.html page was set to *not* cache (say it's
> dynamic content) then Firefox will always fetch that page when going
> to that URL, but still respects the other file's cache headers.  Just
> like you would expect.
>
>
>
> Now, so how lame is IE 5.2 on my Tiger iBook?  (As if I have to ask!)
>
> IE has a number of cache settings.  None make very much sense.
>
> With "Always" set going back to a URL makes these requests:
>
>     http://bumby:3000/about.html  -- 200
>     http://bumby:3000/site/css/common.css  -- 304
>     http://bumby:3000/site/css/style.css  -- 304
>     http://bumby:3000/site/css/banner.css  -- 304
>
> So "Aways" would seem to the best bet, for at least the CSS files.
>
> With "Never" set it does this instead:
>
>      http://bumby:3000/about.html  -- 200
>
> Note that about.html is suppose to be cached:
>
>     $ HEAD http://bumby:3000/about.html
>     200 OK
>     Cache-Control: max-age=86400
>     Connection: close
>     Date: Thu, 16 Feb 2006 18:26:35 GMT
>     Content-Length: 7227
>     Content-Type: text/html; charset=utf-8
>     Expires: Fri, 17 Feb 2006 18:26:35 GMT
>     Last-Modified: Thu, 12 Jan 2006 19:41:23 GMT
>     Client-Date: Thu, 16 Feb 2006 18:26:35 GMT
>     Client-Peer: 192.168.1.2:3000
>     Client-Response-Num: 1
>
> So I wonder why IE is fetching that page again?
>
> Hitting "Refresh" in "Never" mode does this:
>
>     http://bumby:3000/about.html  -- 200
>     http://bumby:3000/images/busy.gif  -- 304
>
> Why only busy.gif?  It's the only image on the page that is not  
> loaded via
> css.
>
> NO combination of shift/option/ctr keys will make IE reload the CSS
> files in Never mode.
>
> Note above that IE never checks to see if images loaded via css have
> changed.  Even clicking "Empty Now" to empty the cache doesn't force
> it to reload or even see if those images have changed.
>
> Of course, anyone using IE on OS X gets what they deserve. ;)
>
>
> -- 
> Bill Moseley
> [EMAIL PROTECTED]
>
> ______________________________________________________________________
> css-discuss [EMAIL PROTECTED]
> http://www.css-discuss.org/mailman/listinfo/css-d
> IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
> List wiki/FAQ -- http://css-discuss.incutio.com/
> Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Phil Palmieri
[EMAIL PROTECTED]



______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to