How to force a web browser NOT to cache images

后端 未结 17 858
太阳男子
太阳男子 2020-11-22 13:51

Background

I am writing and using a very simple CGI-based (Perl) content management tool for two pro-bono websites. It provides the website administrator with HTML

17条回答
  •  野性不改
    2020-11-22 14:42

    With the potential for badly behaved transparent proxies in between you and the client, the only way to totally guarantee that images will not be cached is to give them a unique uri, something like tagging a timestamp on as a query string or as part of the path.

    If that timestamp corresponds to the last update time of the image, then you can cache when you need to and serve the new image at just the right time.

提交回复
热议问题