Answer the question
In order to leave comments, you need to log in
How to bypass browser caching?
The situation is this, in the enterprise, users have Chrome (not tested in other browsers), through which they use my web application. After updating the JS files included in this application on the server, they come back old, i.e. they are already new (changed) on the server, and the browser apparently cached the old code and pulls up as if they had not changed, but pulls up new files. Because of this, errors occur when executing JS.
Moreover, the changed files are pulled up only by updating to F5, if, for example, you get to the application page via a link, or by restarting the browser and going to the applications, they are not updated.
The question is how can this be bypassed?
Answer the question
In order to leave comments, you need to log in
There are 2 ways:
1. Change the name of the included script file.
For example:
Became like this:
2. Easier, without renaming:
Was:
Became:<script src="scripts/libs.js?v=2"></script>
The most effective and proven way is versioning js files. That is, we released a new version of the web application, we change the name of the app_1.2.js files
How to change the name of the included files automatically, this is another question, it depends on the architecture, and in general you need to look at each situation separately.
Some will say that you can change the version through the app.js?v=1.2 parameters, but this scheme does not work on all browsers.
Already ate a dog on it. All of the above solutions do not solve the problem comprehensively, of course, if you receive your files, this is fine, but not remote files (some files are cached on the side of the provider and even Google, for example, the shienen tape passes and the other tape does not, so all sorts of local supervisions work, in including in Eastern Europe, censorship).
It's better than .........scripts/libs- 20150211093711 .js Complexly
solved like this
Changing the extension to scripts/libs- 20150211093711 .php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question