Answer the question
In order to leave comments, you need to log in
Update JavaScript script on the client
How to properly organize the connection of JS on the client's site, so that later at any time the JS script can be updated and it will be picked up by all clients, i.e. would the browser caching be reset? JS, for example, the code for connecting some kind of widget.
It is necessary in order not to ask clients to update its connection code on their sites with each script update.
Answer the question
In order to leave comments, you need to log in
in the header, loader.js is connected,
which never changes (or rarely enough),
this file loads the necessary js files that change often.
and also in the loader, implement the logic for resolving situations with caching, with versioning, and so on.
When writing the script address in the src attribute of the script tag, add a request like ?v1.0
I.e.
<script type="text/javascript" src="/js/core.js?v1.0"></script>
And after update change to
<script type="text/javascript" src="/js/core.js?v2.0"></script>
(or some other way)
TS should not forget that different tama Chrome and other IE with factory settings may be paranoid not to update the files.
Therefore, a good option is to only include mtime files (or version or whatever) in the file name, or change it completely.
Or completely and completely demolish file caching.
There are no other STABLE options.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question