How to update the cache

problem description

how to update the cache through meta without filling in the version numbers of js, css, and img?

the environmental background of the problems and what methods you have tried

because there are too many pages and there are no projects to build, it is really troublesome to change the version number manually because it is done in a pure html+css+js way.
as far as I"m concerned, all I know is to negotiate the cache, check whether the server file is updated, download it again if it is updated, and use the cache if there is no update.
but as far as I know, the following three meta are divided into priority and what. I"m not sure whether they have to be downloaded again every time or as I said.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
< meta http-equiv= "Pragma" content= "no-cache" >
< meta http-equiv= "Cache-Control" content= "no-cache" >
< meta http-equiv= "Expires" content= "0" >

what result do you expect? What is the error message actually seen?

which of the above codes are selected or how to change them can achieve

check whether the server file is updated, download it again if it is updated, and take advantage of the cache if there is no update.

this effect. I hope the bosses can solve my doubts.
because the web talk about caching is too abstract.

Jun.16,2021

those three lines of meta have been configured before, but have not been successfully checked for a long time. I don't know if an extra match is needed to take effect.

provides a bit of an idea:
first of all, understand that caching resources in browsers, such as js, css, image, and so on, are actually taken from the server.
you can configure the cache time on the server according to the actual situation. For example, nginx can set a different cache period for each different resource. After the cache limit is exceeded, the server will get the latest resource next time you ask the server to get it.

therefore, you can set the browser not to cache, the server to set html not to cache, and then add a suffix (such as a timestamp) to the resource to ensure that the resource can be loaded to the latest one after it has been modified. Of course, the premise is that the data in the page is rendered after transmission through the interface in the external js (such as a single-page application).


check whether the server file is updated, download it again if it is updated, and take advantage of the cache if there is no update.

what you need should be ETag

HTTP cache | Web | Google Developers

http-cache-decision-tree

Menu