A forced way to clear browser cache
P粉727531237
2023-08-13 15:04:36
<p>Is there a way I can put some code on my page so that when someone visits the site, it clears the browser cache so they can see the changes? </p>
<p>Languages used: ASP.NET, VB.NET, and of course HTML, CSS and jQuery. </p>
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>
If this is a change regarding
or after the file name:.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:
link to see how it works.