How to know if it saves cache? [duplicate]

-2

Assuming that my last modification of a file was at 17:50 PM, then the user enters but still sees the page as if it has not yet been updated and does not load correctly, as I can check with javascript if it has the latest version of some specific file?

    
asked by Eduardo Sebastian 11.07.2017 в 01:29
source

1 answer

0

To make sure you always load the latest version and avoid cache, you can add a parameter to the query string of the file path like this:

<script src="hosting/mi_archivo.js?version=1.0" />

Whenever you modify the file, you change the version of the route and that's it. This forces the browser to always load the file whenever the version value changes. The value can be anything as long as you update it when you make a change to the file.

So you always know what version it is and that it will always have the last update.

    
answered by 11.07.2017 в 01:53