I have an html page contain Image, the image source is locally,
<img src="c:\bla\bla.png" />
so, the "bla.png" file is changed, I overwrite the image,
How can I refresh the image in the img control without refreshing the whole page?
I have an html page contain Image, the image source is locally,
<img src="c:\bla\bla.png" />
so, the "bla.png" file is changed, I overwrite the image,
How can I refresh the image in the img control without refreshing the whole page?
Try
let url = 'c:\bla\bla.png',
count = 0;
setInterval(function() {
document.getElementById('myimg').src = url + '?cnt=' + count++;
}, 1000);
Change the html a little.
<img id="myimg" src="c:\bla\bla.png" />
Everytime that the image changes you execute this code:
yourImage.src = "http://localhost/image.jpg?" + new Date().getTime();
If you can't catch this event, just instantiate an interval
setInterval(function(){ yourImage.src = "http://localhost/image.jpg?" + new Date().getTime(); }, 1);