0

I want to make a js script to check if there are old cached files and if yes, an auto-reload would be performed or even a notification appears on the top of the screen to reload the page with a button action with the following code.

location.reload(true)

Can I, somehow, check if the user has old cached files compared to the server's one?

I want to check every file included images too!

UPDATE

How to force a web browser NOT to cache images

The solution from the above question doesn't work for me because I have like little icons and logo and many things that can be cached from the browser. I can't put "?{version}" on any file because many icons for example are stored to cache but called from css. So there's no way to change them this way.

  • Not sure if a web server has access to this data, since its stored within their web browser locally. However, as I tend to do using PHP or other languages: `` – Luicy Feb 24 '18 at 18:09
  • Possible duplicate of [How to force a web browser NOT to cache images](https://stackoverflow.com/questions/126772/how-to-force-a-web-browser-not-to-cache-images) – Daniel Beck Feb 24 '18 at 18:14
  • See also the inverse question, [How to force a web browser to cache Images](https://stackoverflow.com/questions/1285354/how-to-force-a-web-browser-to-cache-images). For elements you expect to change frequently, CacheControl headers are preferable to randomized-URL hacks (but note that applying this globally is wasteful of bandwidth for any resources which haven't changed.) – Daniel Beck Feb 24 '18 at 18:14
  • @Luicy I already did that for js and css but I want more, like images loaded from css etc. – Alexandros Bantzos Feb 24 '18 at 18:51

0 Answers0