views:

279

answers:

7

Hi


I’m using a stylesheet as part of a theme and it seems that both IE and Firefox ( or perhaps VS express edition) are caching this stylesheet, since any changes I make to a stylesheet ( such as changing attribute values etc ) aren’t reflected on the displayed page. Any idea how to prevent browser or visual studio from caching this stylesheet?


BTW – only stylesheet is cached, not the entire page

Also, when I've noticed that any changes made to a stylesheet aren’t reflected on a displayed page, I’ve switched from firefox to IE. The first time the page was loaded in IE, page was displayed as it should (reflecting all the changes I’ve made to the stylesheet), but then IE also started caching the stylesheet

thanx

+1  A: 

This guy has a script you can place in your asp pages, FWIW

taylonr
+1  A: 

You can try hitting the shift button when you click the refresh button -- this always worked for me.

Hogan
+4  A: 

If you have Firefox with the Web Developer toolbar, you can easily disable caching. You can also use Ctrl+F5 to refresh the page. Holding Ctrl tells the browser to perform a forced refresh that ignores the cache.

CalebD
It works now. thank you all for providing me several solutions
carewithl
+3  A: 

You could try adding version numbers to your css href:

<link rel="stylesheet" type="text/css" href="path/to/stylsheet.css?v1.0.1" />

The query string (v1.0.1) doesn't affect the css as such, but if the number increments the browser reloads the stylesheet (stylesheet.css).

David Thomas
+4  A: 

One option is to link to the stylesheet in a manner that doesn't allow the browser to cache it. I find this is th case when dealing with things like facebook apps and such.

<link type="text/css" rel="stylesheet" href="/styles.css?v=<%= DateTime.Now %>" />
Russ Bradberry
+1  A: 

As everyone said, press Ctrl+F5 to refresh the page.

If that isn't working then, is this a page you designed or is it part of a project that is shared in the group? It's possible that who ever coded it might be caching the style sheets or page every so often to reduce bandwidth spent.

Daniel
A: 

You could try using meta tags to indicate that the page is appears to be expired. For example:

<head id="Head1" runat="server">
    <title></title>    
     <meta http-equiv="CACHE-CONTROL" content="NO-CACHE, must-revalidate, max-age=0" />
     <meta http-equiv="expires" content="0" />
     <meta http-equiv="Pragma" content="no-cache" />
</head>

I have found that these meta tags aren't always taken into consideration by browsers. IE seems to be the best at detecting that the page shouldn't be cached/the content is expired.

Otherwise, refresh the page to reload the content as has already been suggested.

-Frinny

Frinavale