I have a working Web application that consists of an index.html
file, a number of html pages, a single js
file, and some css
.
This is a brand new application and, as expected, there are some minor bugs that made their way to production.
My question is: After I correct the bugs and replace the relevant file, there are good chances that users' browsers will still load buffered versions of the replaced file and hence the correction would not be seen by those users.
I found some recommendations about using a version tag (something like ...?version=x.y...
) but it is not clear to me how to use it.
Moreover, if I change (for instance) the name of updated file (e.g. from ABC_001.html
to ABC_002.html
) I would also need to change the file that references it, meaning that I would need to change its version as well,... and repeat this till the application's bootstrap point (i.e. index.html
).
What is the standard method that would deploy the new version of files as soon as they are deployed?
If you are going to change the file names, then you will need to change it everywhere where they are referenced. There is no way out of that.
For ensuring that your users always see the updated version of files, using the version number at the end of the links is 1 way. Another way is that you could use the meta tag header in your HTML pages as shown below:
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
Setting this to "no-cache" ensures that the browser always sends a request to the server & doesn't load the cached contents.
You can use the version number technique for your .js & .css files.