I have searched intensive for a solution of my problem but found noting helpful in my case. What i try to archive is 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 to refresh it. Any help is appreciated.
<!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>
2
Answers
Thanks, works as expected. I didn't think to refresh the URL.
Here’s how to add (or replace) a random query string variable in order to force reload of image.