Force browser to clear cache

后端 未结 17 2086
夕颜
夕颜 2020-11-22 05:04

Is there a way I can put some code on my page so when someone visits a site, it clears the browser cache, so they can view the changes?

Languages used: ASP.NET, VB.N

17条回答
  •  名媛妹妹
    2020-11-22 05:45

    There is one trick that can be used.The trick is to append a parameter/string to the file name in the script tag and change it when you file changes.

    The browser interprets the whole string as the file path even though what comes after the "?" are parameters. So wat happens now is that next time when you update your file just change the number in the script tag on your website (Example ) and each users browser will see the file has changed and grab a new copy.

提交回复
热议问题