I am accessing a link on my site that will provide a new image each time it is accessed.
The issue I am running into is that if I try to load the image in the backgr
After creating the new image, are you removing the old image from the DOM and replacing it with the new one?
You could be grabbing new images every updateImage call, but not adding them to the page.
There are a number of ways to do it. Something like this would work.
function updateImage()
{
var image = document.getElementById("theText");
if(image.complete) {
var new_image = new Image();
//set up the new image
new_image.id = "theText";
new_image.src = image.src;
// insert new image and remove old
image.parentNode.insertBefore(new_image,image);
image.parentNode.removeChild(image);
}
setTimeout(updateImage, 1000);
}
After getting that working, if there are still problems it is probably a caching issue like the other answers talk about.