Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS cacheing problem 1

Status
Not open for further replies.

HelloMike

MIS
Feb 14, 2003
210
GB
I have a site that uses 3 CSS files to govern the site's look & feel. There's a common file (common.css), a print-only file (common_print.css) and an end-users "skin" file (anyoldfilename.css). These work well together, and I can simply switch anyoldfilename.css for someotherfilename.css to provide user-specific corporate branding.

When I make mods to any css, javascript, or image files, I naturally want to test, to see the effect of my mods. And I normally force my browser to pick up the new files by simply deleting the cached old files from the Temporary Internet Files directory.

But ... common.css and common_print.css don't appear in the Temporary Internet Files list. So where are they? They're obviously cached somewhere, but I'm blowed if I can find them.

Any help appreciated ...

Mike.
 

I've known the list not to always auto-update, so try pressing F5 in the file view, sorting by name, and then looking for the files.

Hope this helps,
Dan
 
Dan,

Tried it. No deal. the files common.css and common_print.css just plain don't appear in C:\Documents and Settings\myaccount\Local Settings\Temporary Internet Files, or indeed in anyotheraccount :(
 
Inside the <head> area ...
Code:
    <style type="text/css" media="all"> @import url("/myapp/css/common.css"); </style>
    <style type="text/css" media="print"> @import url("/myapp/css/common_print.css"); </style>
    <style type="text/css" media="all"> @import url("/myapp/css/userskin.css"); </style>

Since I last posted I found a workaround ... I'm using IE6 so I went into Tools -> Internet Options -> General -> Temporary Internet Files -> Settings, and switched the "Check for newer versions of stored pages" radio-set from "Automatic" to "Every time you start Internet Explorer". Then I re-ran my app in a new instance of IE and all was well.

So my original question has become academic, although I'm still curious.

Mike.
 

Hmm - I've not used that syntax for linking in CSS files. I normally use this:

Code:
<link rel="stylesheet" href="screen.css" type="text/css" media="screen, projection, tv" />
<link rel="stylesheet" href="print.css" type="text/css" media="print" />

etc.

Does this make a difference?

Hope this helps,
Dan
 

In fact, maybe that's just it - your page isn't directly linking to any CSS files... And it looks like imported CSS files aren't cached by IE - which looks like a neat way of avoiding caching files if you need to ;o)

Dan
 
Dan, it's a syntax aimed at excluding NS4 - modern browsers understand @import, NS4 doesn't. It means that NS4 just shows a plain, unstyled page rather than mangling it up with its horrible CSS implementation.

Mike, try holding down the shift key when you reload a page - it should do a full refresh ignoring any cached files.

-- Chris Hunt
 
Chris,

try holding down the shift key when you reload a page - it should do a full refresh ignoring any cached files.

Excellent tip. Tried it on my co-worker's PC and it worked just fine.

Dan,
Thanks for your help anyway. I'll be sticking with the @import syntax on this occasion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top