How to force the browser to reload cached CSS/JS files?

后端 未结 30 4402
青春惊慌失措
青春惊慌失措 2020-11-21 05:49

I have noticed that some browsers (in particular, Firefox and Opera) are very zealous in using cached copies of .css and .js files, even be

30条回答
  •  闹比i
    闹比i (楼主)
    2020-11-21 06:08

    You can force a "session-wide caching" if you add the session-id as a spureous parameter of the js/css file:

    
    
    

    If you want a version-wide caching you could add some code to print the file date or similar. If you're using Java you can use a custom-tag to generate the link in an elegant way.

    
    
    

提交回复
热议问题