I am trying to refresh a screenshot from my webcam in a webpage continously. Not the whole page.
This is my current code, which only shows a screenshot without refreshing it:
<!DOCTYPE html>
<html>
<body>
<script language="JavaScript">
var myImageElement = document.getElementById('camshot');
myImageElement.src = 'api.jpg?rand=' + Math.random();
setInterval(function() {
var myImageElement = document.getElementById('canshot');
myImageElement.src = 'api.jpg?rand=' + Math.random();
}, 10000);
</script>
</body>
<img src="http://192.168.0.168/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C" id="camshot" >
</html>
Here's how to add (or replace) a random query string variable in order to force reload of image.