Forced Image Refresh

  • Thread starter Thread starter Paul Johnson
  • Start date Start date
P

Paul Johnson

I have a web site that allows users to upload images. The problem is when
an image is uploaded over the top of another image the user would have to
press F5 to refresh the images and clear the cashe. Is there anyway I can
automatically make the image refresh?

If that is not possible is there a way of making the whole page refresh
automatically?
 
Paul said:
I have a web site that allows users to upload images. The problem is when
an image is uploaded over the top of another image the user would have to
press F5 to refresh the images and clear the cashe. Is there anyway I can
automatically make the image refresh?

If that is not possible is there a way of making the whole page refresh
automatically?

I always add a querystring arg to the image tag's src that is
time-dependent. For example, the UTC time on the server, which would
look something like this

http://mysite.com/image.aspx?uid=99123833 OR
http://mysite.com/image.gif?uid=99123833

that way the url that is given to the browser is always unique and
forces a new request to download it again.

Learned that from the old IE5 days, when that browser cached everything
it could and wouldn't react to HTTP expiration headers (or at least it
seemed it was way too difficult to figure out how to get things not to
cache).....
 
Back
Top