how to clear my clients cache next time they log in

后端 未结 6 1745
萌比男神i
萌比男神i 2021-01-11 18:27

I have an application running on hostgator. When I make changes to the js files my users don\'t see the changes until they clear their cache. Is this the only option to pu

6条回答
  •  失恋的感觉
    2021-01-11 19:00

    You need to use versioning on your file includes. Anytime you change the URI of your file includes, the browser won't find a cache match and will re-download the include.

    For example:

    
    

    Where 232 is your modifiable version number that should be changed whenever you release new code.

    Alternatively, you can use query strings:

    
    

    The point is that you should change the file include URI in some manner whenever you want your visitors to re-download the file.

    If you use PHP or another server-side language, you can setup this versioning to occur automatically whenever your file includes are modified: http://derek.io/blog/2009/auto-versioning-javascript-and-css-files/

提交回复
热议问题