I'm using javascript to dynamically load any of a series of images into a single img tag, based on user interaction:
function reassignImage(newSource)
{
img.src = newSource;
}
This works great, except that I when I inspect it with Chrome developer tools, I see that even if I reload an image I've already loaded, it makes another http call AND grows the total Images Size graph.
This seems like the worst of both worlds. I would want either:
- To load from cache if the image were the same.
- To reload each image everytime, but then not grow the cache.
How would I achieve either scenario?
Thanks! Yarin