php_nub_qq php_nub_qq - 1 year ago 123
HTTP Question

Tell the browser to drop cache of image

I have the common problem where when users change their profile picture it will not immediately appear on the web page, they will keep seeing the old one until the browser decides to drop the cached version.

The common solution for this problem is to add some unique query string so that the browser will not have it cached, like


This causes another problem for me - it gets logged in the web server's access logs and when they are being parsed each request gets counted as a separate resource, where actually it is requesting the same resource with a different query string.

Is there any particular solution on the client side where I can tell the browser to explicitly drop the cache of the image that the user is about to upload, so it will get downloaded again when the page refreshes?

Answer Source
<img src="img.png?lastmod=yourtimeinnumbers"...

it will give a cache option for img without dropping the browser cache

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download