0

I realize this question has been asked before. I have read the previous questions, and the solutions are not working for me. Chrome absolutely refuses to clear all cached data. This is interfering with my ability to test a website I am developing.

Issue: No matter how I attempt to clear cached data for my website, Chrome still serves cached versions of some parts of index.html. It almost always occurs with CSS embedded in a <style> tag in the head of my index.html file. I will make a change to this CSS, restart the Python code that serves index.html "Empty Cache and Hard Reload" the page and Chrome will use the exact same CSS as before, without my changes.

I have tried the following:

  • Going into Chrome settings and clearing all data from the beginning of time.
  • Restarting the browser.
  • Checking the "Disable Cache" option in the network tab of the dev tools (and refreshing)
  • "Empty Cache and Hard Reload"
  • Sending the header Cache-Control: no-store, no-cache, must-revalidate, max-age=0
  • All possible combinations of these steps.

I wrote the server code myself. It's very simple and absolutely not serving the same thing over and over again. I restarted it every time I tried to clear the cache just to be sure.

What is even stranger in my opinion, is that changes made to the actual html in index.html are reflected in the browser. It's like Chrome is choosing to cache the contents of the <style> tag but behaving with everything else.

I have a very annoying solution to this problem. If I increment the port number that the server is running on every time I make a change, Chrome will not use any kind of cache on the first load. I'd rather not have to do this.

This is probably irrelevant, but both the server and the browser are on the same Windows 10 computer.

0

Very annoying/hacky solution: Change the port that you are serving files from every time you make a change.

5
  • Which port? What about other solutions like appending a question-mark to the URL?
    – harrymc
    Jan 19 '21 at 14:41
  • I started at 8080 and kept going up. I actually hadn't thought of the question mark idea. I'll give that a shot. Jan 19 '21 at 15:37
  • You could also do Incognito browsing.
    – harrymc
    Jan 19 '21 at 16:01
  • I hadn't thought of that either. I'll give it a shot, thanks. Jan 19 '21 at 16:28
  • If they work for you, let me know and I'll add an answer.
    – harrymc
    Jan 19 '21 at 16:31

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.