johnsmith153 — 2012-10-12T23:46:09-04:00 — #1
I believe appending a version number to a JS file allows me to change that version number to guarantee a user isn't viewing an old, cached version of the file.
But what is best?
Obviously (2) needs the filename changing, but looking at it, does (1) work? I'm 100% that (2) would work.
Are there any other downfalls of either of the methods? What do other people use?
I need to be 100% certain that changing the version number will ensure nobody gets an old file.
logic_earth — 2012-10-13T01:14:03-04:00 — #2
Both would work. Both would achieve the same thing. Pick the one you like best.
ralphm — 2012-10-13T04:08:17-04:00 — #3
paul_wilkins — 2012-10-13T04:55:07-04:00 — #4
Another commonly used way now is to use a build system, so that all of your related files are packaged up in to just the one file.
For example, RequireJS has an optimizer that combines and minifies them in to just the one file, which can have its time/date in the filename.