I have an img tag on my web page. I give it the url for an IP camera from where it get images and display them. I want to show image when it is completely loaded. so that I
Preload the image and replace the source of the after the image has finished loading.
function LoadImage() { var img = new Image(), x = document.getElementById("stream"); img.onload = function() { x.src = img.src; }; img.src = "http://IP:PORT/jpg/image.jpg" + "?_=" + (+new Date()); }