Inserting an <img src="X"> into the DOM with javascript under IE ignores image cache

T

Todd

Please help!

Under IE6, I'm dynamically modifying my page with some javascript
which inserts some elements into the page's DOM.

For example:

function RenderNewLayerSyms (destEl, controlNumber) {
for (var i=0; i<5; i++) {
var empty = document.createElement ('img');
empty.src = VirtualAppRoot + 'images/rbsempty.gif';
empty.id = 'rr_' + controlNumber + '_sym_' + (i + 1);
empty.alt = 'Rate this DVD ' + (i + 1) + ' out of 5';
empty.onmouseover = NewRRMouseOver;
empty.onclick = NewRRClick;
destEl.appendChild (empty);
}
}

It all works fine, but when I insert an image tag, say

<img src='images/rbsempty.gif'>

into the page, the browser requests a new copy of X.gif from the web
server *every* time. This is a problem becuase I'm inserting 100+ of
these tags dynamically - and making 100+ requests to get the same
image over and over. Why isn't it caching?

Thanks,
Todd.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top