P粉2535186202023-08-14 11:40:18
See the cache-control and expires META tags.
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon , 22 Jul 2002 11:12:01 GMT">
Another common practice is to append a changing string to the end of the requested file. For example:
<script type="text/javascript" src="main.js?v=12392823"></script>
P粉5879700212023-08-14 00:20:37
If this is a change regarding .css
and .js
, one way to do this is by appending something like "_versionNo# to the end of each published filename ##" content to perform "cache destruction". For example:
script_1.0.css // 这是发布 1.0 的 URL script_1.1.css // 这是发布 1.1 的 URL script_1.2.css // 等等or after the file name:
script.css?v=1.0 // 这是发布 1.0 的 URL script.css?v=1.1 // 这是发布 1.1 的 URL script.css?v=1.2 // 等等You can check out this
link to see how it works.