Page 1 of 1

Webcam Refresh Script

Posted: Thu 06 Sep 2012 7:59 am
by richardmhowell
Hello All,

I had been looking for a script to refresh the webcam images on my site without refreshing the entire page, after a bit of digging i found this;

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
refreshImage = function()
{
img = document.getElementById("cam");
img.src="http://ephratareview.com/cam/mainstate.jpg?rand=" + Math.random();
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Auto-Refresh</title>
</head>
<body onload="window.setInterval(refreshImage, 1*1000);">
<img src="http://ephratareview.com/cam/mainstate.jpg" id="cam" />
</body>
</html>
I got this to work perfectly for me on my site and wanted to share it incase anyone else needed something simillar.

Rich

Re: Webcam Refresh Script

Posted: Tue 27 Nov 2012 3:26 pm
by beteljuice
Didn't read the webcam section then ?

Re: Webcam Refresh Script

Posted: Mon 11 Aug 2014 4:05 am
by ace2
richardmhowell wrote:Hello All,

I had been looking for a script to refresh the webcam images on my site without refreshing the entire page, after a bit of digging i found this;

Rich
Maybe be a old post, but still does the job, tx...