Tuesday, February 7, 2012

Image (<IMG>) SRC Dynamic Update Using Script Not Working in IE

If you have HTML code running this dynamically changing image:





<img src="myscript" id=myID>

This won't work in IE. You need this:


var randomNo=Math.floor(Math.random()*10000);



As IE will refer to cache data if it sees the data is the same as the next click.
You can also change to other methods of generating random numbers. As long as the query string is different every time, IE will not refer to cache data and fetch from the server instead.
Read More »