How to disable caching in Chrome for a specific website?

I am developing Javascript for the website www.example.com, and Chrome saves caching of earlier versions of my code. I can constantly clear the cache, but it becomes a stream of time. Any other options?

+6
source share
7 answers

Usually I press: ctrl + shift + r to clear the cache. This I consider the easiest.

This also works:

<meta http-equiv="no-cache"> <meta http-equiv="Expires" content="-1"> <meta http-equiv="Cache-Control" content="no-cache"> 
+13
source

If you do not want to change the code of your web page. You can simply open the developer tools in Google Chrome. Shortcut: Ctrl + Shift + I on the windows.

In the lower right corner you will find a mechanism that will lead you to the settings. Check the "disable cache" box and you're good to go.

+16
source

If you use an incognito window for debugging, it does not have cached data. Simple and does not require changes in your browser settings.

+4
source

I do it myself for development. I am using CTRL-F5. This is like a power upgrade. This refreshes the page, including reloading any associated JS files or CSS files, even if they were cached.

+1
source

Add these headers to your web pages during development:

 <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> 

Or you can configure the web server to add cache information to the http headers (during development).

0
source

you can add a rule in .htaccess for not caching a specific file or a specific extension

 <FilesMatch "script.js$"> Header unset Cache-Control Header unset Expires Header unset Last-Modified FileETag None Header unset Pragma </FilesMatch> 

or for all .js and css

 <FilesMatch "\.(js|css)$"> 
0
source

Try setting the HTTP header:

 Cache-Control: no-cache, no-store 

Or:

 <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE, NO-STORE"> 

But this should only be used during development.

0
source

Source: https://habr.com/ru/post/891678/


All Articles