Is There a ≪Meta≫ Tag to Turn Off Caching in All Browsers

How to prevent caching of my Javascript file?

Add a random query string to the src

You could either do this manually by incrementing the querystring each time you make a change:

<script src="test.js?version=1"></script>

Or if you are using a server side language, you could automatically generate this:

ASP.NET:

<script src="test.js?rndstr=<%= getRandomStr() %>"></script>

More info on cache-busting can be found here:

https://www.curtiscode.dev/post/front-end-dev/what-is-cache-busting

BufferedDynamicImageResource cached by browser

The most common way to solve this would be to mount the resource as seen here. Using this approach, you could use the id as a parameter or add an (ignored) random parameter to prevent caching completely.

Cache-Control through Front-End?

So in the end, this is almost always better solved on the server-side. @RenanIvo did comment a good link on the depreciated HTML meta cache control, and im my experience the server is always the answer (or at least the best one).



Related Topics



Leave a reply



Submit