Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome is not clearing cache

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.

like image 520
AndyPet74 Avatar asked Dec 19 '16 17:12

AndyPet74


People also ask

Why clear cache is not working?

Here are some ways you can try to fix your caching problem, in order of escalation: Try holding down the Shift key while pressing the Refresh button. Close your browser and re-open it (make sure you are NOT on the cached page) and delete your temporary Internet files (clear your cache).

Why my Ctrl F5 is not working?

You have a keyboard with an F-Lock key. The function lock is currently on. "Open file" and "Print" are the meanings of F5 and F12 when function lock is on. So just turn it off.


3 Answers

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

like image 172
Pizza lord Avatar answered Oct 16 '22 22:10

Pizza lord


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.

like image 9
AndyPet74 Avatar answered Oct 17 '22 00:10

AndyPet74


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

like image 2
Luis H Cabrejo Avatar answered Oct 16 '22 22:10

Luis H Cabrejo