Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Private browsing and Ctrl+F5 doesn't seem to be cutting it?

(I've got a lot of ajax loaded content)

share|improve this question

migrated from stackoverflow.com Mar 29 '10 at 10:53

This question came from our site for professional and enthusiast programmers.

    
Duplicate: stackoverflow.com/questions/2263096/… –  Pekka 웃 Mar 29 '10 at 10:44

6 Answers 6

Sometimes I hit ctrl-shift-delete, it prompts for things to delete, I delete the cache and sometimes the cookies. Then I hit F5.

share|improve this answer

Simple put some variable behind *.css. For example, ? and time() function.

share|improve this answer
    
I would avoid using time() as this would invalidate the cache on every page load. Unless the styles are being uniquely generated each time (why?), this is inappropriate outside of a development environment. –  akamike Mar 29 '10 at 10:50

You can append the stylesheet URL with a query string to render the cache as no longer valid. For example, a version number.

<link rel="stylesheet" href="/css/style.css?1.1" type="text/css" />

This is assuming you are looking for a method to invalidate the cache for everyone. If you are simply looking to clear your own cache, this belongs on Super User.

share|improve this answer

Stick a version number as a querystring to the CSS file:

<link href="/style.css?1" rel="stylesheet" />

Or if you want it to never be cached, stick something like the time there:

<!-- php -->
<link href="/style.css?<?=time();?>" rel="stylesheet" />
<!-- asp.net -->
<link href="/style.css?<%=DateTime.Now.Ticks%>" rel="stylesheet" />
share|improve this answer

You can also use the Firefox Webdeveloper addon. It has a function to disable your cache.

share|improve this answer
2  
Fantastic solution. 'Hey visitors, to use this site, you're gonna need Firefox and this addon and then go disable your cache!' –  Charlie Somerville Mar 29 '10 at 10:52

I solved this problem by specifying the complete URL of the external style sheet.

Replace this:

link href="style.css" rel="stylesheet" type="text/css" media="all"

with this:

link href="http://www.domainname.com/style.css" rel="stylesheet" type="text/css" media="all"

FF instantly loaded the new style sheet.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.