Whenever I run the project, many files(CSS, image and js) requested from a remote server and the project load slowly.
For handling this issue, I unchecked disable cache for all files in the network tab of Chrome DevTools(for caching all files) as follows:
But the problem started when I need some files(for example test.js,...) don't cache because they change quickly.
How to disable cache for some files(JS, CSS,...) in google chrome DevTools?
Here's how to clear the browser cache for just one web page: Open the webpage you want to clear the cache for, and go into Chrome Developer Tools. That's CMD+Option+I on a Mac, and CTRL+Shift+I or F12 on Windows, Linux, and Chromebooks. Click Empty Cache and Hard Reload in the list of options, and you're done.
Limit Chrome cache size in Windows 10After opening it, right-click on the Chrome icon in the taskbar. In the list, right-click on “Google Chrome” and select “Properties“. In the “Target” field, add --disk-cache-size=1073741824 flag at the end of the file path. Click on the “Ok” button to save the changes.
There are many ways to disable cache for specific files.
Maybe the two most common are:
Add query to your script file name ie:
<script src="../whatever/someFile.js?version=1234" />
//Where version can be a variable taken from web.config or DateTime.Now() of some sort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With