Google Answers Logo
View Question
Q: META refresh for web cam images too ( Answered 5 out of 5 stars,   1 Comment )
Subject: META refresh for web cam images too
Category: Computers > Programming
Asked by: jhabley-ga
List Price: $5.00
Posted: 11 Feb 2003 17:10 PST
Expires: 13 Mar 2003 17:10 PST
Question ID: 160238
I've got a web page that references the images from two web cams.
These cameras upload new images every minute. I know how to do a META
REFRESH code to refresh the page, BUT that doesn't also refresh the
images. The auto-refreshed simply uses the cached image. You only get
new images when you manually refresh.

What HTML code do I use to force auto-refresh on the page AND images?

Request for Question Clarification by tar_heel_v-ga on 11 Feb 2003 17:17 PST
Would a javascript or other script that updates your images suffice as an answer?


Clarification of Question by jhabley-ga on 11 Feb 2003 17:20 PST
Pure HTML is preferred, but if it simply isn't possible with HTML,
then a bulletproof JavaScript code would be okay as well. If it's JS,
it's important that the code works across as many browsers as
possible. Thanks.
Subject: Re: META refresh for web cam images too
Answered By: sycophant-ga on 11 Feb 2003 20:32 PST
Rated:5 out of 5 stars
Hi Jhabley,

The problem is fooling the browser's cache.

The easiest way, and one that works in most cases is to append a '?'
to the end of the image SRC, this way the browser generally treats the
image as if it were a dynamic object as it assumes you are passing
values. Sometimes you may need to actually use fake values.

However sometimes this doesn't work as there are transparent proxy
servers between you and your target.

Try it like so:

<title>Cam Images</title>
<meta http-equiv=Refresh content="60; URL=">
<meta http-equiv=Expires content="Wed, 01 Jan 2003 12:00:01 GMT">
<h1>Cam 1</h1>
<img src="http://www.some.server/cam/cam.jpg?blah=1">
<h1>Cam 2</h1>
<img src="http://www.someother.server/cam/cam.jpg?blah=1">

If that doesn't work in your situation, let me know and I can make
some suggestions, however that technique has been successful for me on
most occasions. Obviously your implementation will be slightly
different :)

Also, the Expiry tag is probably not needed, but it can't hurt. 

jhabley-ga rated this answer:5 out of 5 stars
Perfect - works like a charm.

Subject: Re: META refresh for web cam images too
From: guymac-ga on 11 Feb 2003 20:45 PST
If you can take care of the problem at the source, it will be easier
than various browser tricks. The web server that is sending the images
should be setting the Last-Modified and Expires HTTP headers. It
should also send the various no-cache HTTP directives. That way when
the browser requests the image, it will know to not cache it.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy