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

后端 未结 30 4274
青春惊慌失措
青春惊慌失措 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条回答
  •  臣服心动
    2020-11-21 06:09

    In Laravel (PHP) we can do it in following clear and elegant way (using file modification timestamp):

    
    

    And similar for CSS

    
    

    Example html output (filemtime return time as as a Unix timestamp)

    
    

提交回复
热议问题