Chrome is not clearing cache

27,182

Solution 1

Development server was running various caching tools though they should have been turned off. After disabling them chrome started to work better and most of the time CTRL+F5 did the trick.

Solution 2

pres f12 > f1 > network > disable cache (while DevTools is open). This should solve your problem

Solution 3

"clearing cache" is not as easy as it should be. Instead of clearing cache on my browsers, I realized that "touching" the server files cached will actually change the date and time of the source file cached on the server (Tested on Edge, Chrome and Firefox) and most browsers will automatically download the most current fresh copy of whats on your server (code, graphics any multimedia too). I suggest you just copy the most current scripts on the server and "do the touch thing" solution before your program runs, so it will change the date of all your problem files to a most current date and time, then it downloads a fresh copy to your browser:

  <?php
    touch('/www/sample/file1.css');
    touch('/www/sample/file2.css');
    touch('/www/sample/file2.css');
   ?>

then ... the rest of your program...

It took me some time to resolve this issue (as many browsers act differently to different commands, but they all check time of files and compare to your downloaded copy in your browser, if different date and time, will do the refresh), If you can't go the supposed right way, there is always another usable and better solution to it. Best Regards and happy camping. By the way touch(); or alternatives work in many programming languages inclusive in javascript bash sh php and you can include or call them in html.

Solution 4

I used to have the same problem, and I believe it's a (pretty annoying) bug with chrome. You can use the CSS Reloader Chrome Extension to solve it. Not ideal, but better

Share:
27,182
AndyPet74
Author by

AndyPet74

I attend University of Nebraska Lincoln as a Computer Engineer undergraduate and when I am not in class or studying I am usually working for a small local company as an general IT associate and programmer. I have been really interested in computers for many years now and I am especially glad to be in college where I can focus my studies on things I really like, except Physics, I really don't enjoy physics too much but gotta get through it. :)

Updated on June 13, 2020

Comments

  • AndyPet74
    AndyPet74 almost 4 years

    I am working on a new site and whenever I change CSS settings chrome will not accept those changes unless I close out of chrome completely with Task manager and relaunch it. I have a tried quite a few things. Below is a list of things I've tried:

    • Versioning the CSS file (I am using a PHP date stamp at the end of the CSS file
    • Enabling "Clear Cache while developer window is open" in the Developer console
    • Using Ctrl + F5 to clear cache on refresh
    • Going to Application and Clear Storage in the developer Console
    • Clearing Cache folder in local AppData
    • Deleting CSS file from stie, refreshing, and readding file.
    • Incognito mode
    • Adding Launch options to chrome shortcut --disk-cache-dir=null
    • Adding Browser Plugins to delete cache.

    Anyone have any ideas how to help? It is extremely annoying and inefficient to close chrome every time I want to check a CSS change. Another annoyance is that I am trying to listen to music in the browser so if I close chrome I have to go back and get my music playing again and it's just as of now extremely annoying and way more time consuming than I want.

    I've tried looking at other articles online about cache busting and other articles on Stack Overflow but I've tried to do most of what they suggest and I haven't seen any positive outcome yet. Most articles say to add some sort of random string or version on the end of the CSS file as a GET request but that isn't working though I know that has worked for me in the past.