1

I'm trying to find how to prevent caching of files for single-page application. So far what I have found out is that I can set it up in IIS - which I have done - but I have also read that the best way of preventing caching is to add random string as a URL parameter to a file name (so instead of loading script.js, I would be loading script.js?v=1231233 and the number would change every time).

Of course, I would prefer to also use the second method, but since all files are static (.html), I can't automatically generate this random number, I would have to write it manually every time, which is not possible. One way of doing this which I thought of was doing it using javascript (document.write()), but this solution seems kind of ... "ugly" ... or is it?

My main question is: is there any other way of preventing the caching besides the two mentioned? Is the first method sufficient and supported among the recent browsers (>IE10, Chrome, Safari, Firefox, ...).

Anyway, I would be thankful for any other ideas/suggestions you may have.

Thanks

leopik
  • 2,323
  • 2
  • 17
  • 29

0 Answers0