How can I force clients to refresh JavaScript files?

后端 未结 26 2676
旧时难觅i
旧时难觅i 2020-11-22 03:40

We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slo

26条回答
  •  日久生厌
    2020-11-22 04:23

    If you're generating the page that links to the JS files a simple solution is appending the file's last modification timestamp to the generated links.

    This is very similar to Huppie's answer, but works in version control systems without keyword substitution. It's also better than append the current time, since that would prevent caching even when the file didn't change at all.

提交回复
热议问题