Grow your CSS skills. Land your dream job.

Firefox Force Clear Cache

  • # June 28, 2009 at 2:44 pm

    Hi All,

    I was wondering if anybody knows of any code that I could place onto my site that would FORCE firefox to update its cache of the site its viewing?

    I’ve recently changed my site around but firefox is showing the old cached version when it first loads up. I know I can hit refresh and it will change to the new one (which is does)…..But, I dont want all the users viewing my website to have to do that as it puts out a bad impression….

    Any ideas?

    Thanks in advance.

    # June 28, 2009 at 3:04 pm

    It depends what you have changed. If it is just the css then rename your css file to something like style1.css.

    It can also be achieved by adding this to your .htaccess file but then the page will never cache which is also not good.

    Code:
    Header set cache-Control: “no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0″
    # June 28, 2009 at 4:14 pm

    Thanks for this.

    I’ve actually completely changed the site. New design, new content, new CSS, the lot.

    But, for the some reason it still shows parts of the old site. Something I have done though is archive the old site on my FTP server into an ‘Archives’ folder, would you recommend deleting it completely? ‘Cause i didn’t think it would have caused any conflicts but it just seems to be a little.

    Any other ideas guys?

    # June 28, 2009 at 4:29 pm

    Then I would contact your webhosting company.

    # June 28, 2009 at 4:44 pm
    "in4308" wrote:
    But, for the some reason it still shows parts of the old site. Something I have done though is archive the old site on my FTP server into an ‘Archives’ folder, would you recommend deleting it completely?

    Yea… some thoughts: If they ctrl+f5 does it update the images? Or is it still a problem for every browser?
    If it’s a problem for every browser (after the hard refresh), the old image is still being linked to. (The link could have been updated when you moved it.)
    If it is corrected after a refresh, see idea below:

    "apostrophe" wrote:
    If it is just the css then rename your css file to something like style1.css.

    Or, an easier way to rename the file is by adding a quertystring to it:

    style.com?1

    Although the file doesn’t change at all, it looks like a new file and so is refreshed. You can do this to images too:

    img.jpg?2

    I hope that helps.

    # July 16, 2009 at 11:00 am

    For this I would go with the query string idea, in the future you should just add a meta string:

    [url]
    <meta HTTP-EQUIV="Expires" CONTENT="Tue, 17 Jul 2009 21:00:00 GMT">
    [/url]

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".