Website needs force refresh after deploy

前端 未结 3 1271
孤城傲影
孤城傲影 2021-02-05 02:13

After deploying a new version of a website the browser loads everything from its cache from the old webpage until a force refresh is done. Images are old, cookies are old, and s

3条回答
  •  旧时难觅i
    2021-02-05 02:48

    You can append a variable to the end of each of your resources that changes with each deploy. For example you can name your stylesheets:

    styles.css?id=1
    

    with the id changing each time.

    This will force the browser to download the new version as it cannot find it in its cache.

提交回复
热议问题