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

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

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

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


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.


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.


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


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

  • 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

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" />

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

  • 2
    Fantastic solution. 'Hey visitors, to use this site, you're gonna need Firefox and this addon and then go disable your cache!' – anonymous coward Mar 29 '10 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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