Force browser to clear cache

后端 未结 17 2337
夕颜
夕颜 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:43

    Not as such. One method is to send the appropriate headers when delivering content to force the browser to reload:

    Making sure a web page is not cached, across all browsers.

    If your search for "cache header" or something similar here on SO, you'll find ASP.NET specific examples.

    Another, less clean but sometimes only way if you can't control the headers on server side, is adding a random GET parameter to the resource that is being called:

    myimage.gif?random=1923849839
    

提交回复
热议问题