[BNM] avoid image cache

Jeremy Keith jeremy at adactio.com
Thu Nov 13 12:40:23 GMT 2003


Robert Stevens wrote:
> I have an image in a table-cell that gets updated on the server every 
> 30
> minutes or so via a webcam.
> Is there a simple way to avoid this image being cached by the browser 
> (so
> the latest image will always appear when the page loads)?

When you link to the image, add a randomly generated variable in the 
query string:

<img src="/images/webcam.jpg?foo=ehfhaavbzrla" alt="webcam image" />

You can generate this random variable server-side with a bit of 
PHP/ASP/Cold Fusion or you could do it with JavaScript using 
document.write.

The addition of that variable *should* stop the browser caching the 
image.

HTH,

Jeremy

-- 
Jeremy Keith

a d a c t i o

http://adactio.com/



More information about the BNMList mailing list