How can I force clients to refresh JavaScript files?

后端 未结 26 2673
旧时难觅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:20

    As far as I know a common solution is to add a ? to the script's src link.

    For instance:

    
    

    I assume at this point that there isn't a better way than find-replace to increment these "version numbers" in all of the script tags?

    You might have a version control system do that for you? Most version control systems have a way to automatically inject the revision number on check-in for instance.

    It would look something like this:

    
    

    Of course, there are always better solutions like this one.

提交回复
热议问题