If an HTML file (say, index.html) as well as a javascript file (say, library.js) are both updated, how do I ensure that the end-user’s browser downloads the newest versions of both files? That is, how to avoid the scenario of the browser having the newer version of the index.html but the older version of library.js?
One solution I can think of is to have version numbers embedded in the filename of the javascript file. (E.g. library-v3-0-1.js) But that seems a lot of housekeeping effort is required, especially when there are a lot of files and a lot of updates (such as during development phase).
One thing that might help would be to set the HTTP cache headers using the server/server-side scripting settings to make sure files aren’t cached too long if you update frequently. Setting “no-cache” might be the best option for very frequent changes. Another option, like you said, would be to ensure each new update has a unique name (such as version/date).