Disabling Chrome cache for website development

786,262

Solution 1

The Chrome DevTools can disable the cache.

  1. Right-click and choose Inspect Element to open the DevTools. Or use one of the following keyboard shortcuts:
  • F12
  • Control+Shift+i
  • Command+Shift+i
  1. Click Network in the toolbar to open the network pane.
  2. Check the Disable cache checkbox at the top.

screenshot of development tools panel

Keep in mind, as a tweet from @ChromiumDev stated, this setting is only active while the devtools are open.

Note that this will result in all resources being reloaded. Should you desire to disable the cache only for some resources, you can modify the HTTP header that your server sends alongside your files.

If you do not want to use the Disable cache checkbox, a long press on the refresh button with the DevTools open will show a menu with the options to Hard Reload or Empty Cache and Hard Reload which should have a similar effect. Read about the difference between the options to know which option to choose. The following shortcuts are available:

  • Command+Option+R on Mac
  • Control+Shift+R on Windows or Linux

long press

Solution 2

enter image description here

Clearing the cache is too annoying when you need to clear the cache 30 times an hour.. so I installed a Chrome Extension called Classic Cache Killer that clears the cache on every page load.

Chrome Store Link (free) (Now without malware!)

Now my mock json, javascript, css, html and data refreshes every time on every page load.

I never have to worry if I need to clear my cache.

There are about 20 cache cleaners for Chrome I found, but this one seemed lightweight and zero effort. In an update, Cache Killer can now stay "always on".

Note: I do not know the plugin author in any way. I just found it useful.

Solution 3

Picture of reload menu

  1. Pull up the Chrome developer console by pressing F12 and then (with the console open):

  2. Right click (or hold left click) on the reload button at the top of the browser and select "Empty Cache and Hard Reload."

This will go beyond "Hard Reload" to empty the cache entirely, ensuring that anything downloaded via javascript or etc. will also avoid using the cache. You don't have to mess with settings or anything, it's a quick 1-shot solution.

Solution 4

If you do not wish to edit Chrome's settings you may use incognito mode for the same results.

Solution 5

  1. F12 to open Chrome DevTools
  2. F1 to open DevTools Settings
  3. Check Disable cache (while DevTools is open) as shown below:

This is currently on the Preferences tab which is the default. You may need to scroll down. This checkbox has been moved at least a couple times since this question was asked. Last I checked, it was in the middle column at the bottom. If you have it open on a thinner screen and there are 2 columns under Preferences, it may be near the top right. Feel free to update this post if it changes or comment and I'll update the post.

enter image description here

Share:
786,262
tomermes
Author by

tomermes

https://www.linkedin.com/in/tomer-mesika-0aa7b242/

Updated on May 03, 2021

Comments

  • tomermes
    tomermes about 3 years

    I am modifying a site's appearance (CSS modifications) but can't see the result on Chrome because of annoying persistent cache. I tried Shift+refresh but it doesn't work.

    How can I disable the cache temporarily or refresh the page in some way that I could see the changes?