Why does Firefox sometimes cache my CSS & Javascript code, even though it has changed?

前端 未结 7 1896
情深已故
情深已故 2021-01-12 21:20

On my product site, Firefox sometimes \"doesnt detect\" changes in my CSS & Javascript code. Rather it loads the old versions, so it seems that I need to clear the cache

相关标签:
7条回答
  • 2021-01-12 22:21

    You can use a technique called "cache busting" where you attach a query string to your call to your css/js file. You then update the query string whenever you update your css/js.

    Example:

    <link rel="stylesheet" type="text/css" href="/styles.css?ver=1" />
    
    0 讨论(0)
提交回复
热议问题