Disabling Chrome cache for website development
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.
Pull up the Chrome developer console by pressing F12 and then (with the console open):
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.
The Chrome DevTools can disable the cache.
- 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
- Click
Network
in the toolbar to open the network pane. - Check the
Disable cache
checkbox at the top.
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+Shift+R on Mac
- Control+Shift+R on Windows or Linux