The simplest way to prevent them from reloading is not to rewrite the HTML and create a new img
tag every 2.5 seconds.
It looks like your images are being set as avatar.php?size=14&hash="+ustr+"
, where ustr
is the important bit which identifies the image.
First, I'm guessing that the ustr
value is meant to be the same each time? Check that the ustr
value isn't changing each request. If it is, then as far as your code can tell, there really is a different image each time. You may want to fix your server code.
Rather than simply blasting a big pile of text into the actstream
div's innerHTML
property, I'd suggest putting ID's on each component - then you can find and update the time, str, user and act values individually.
Once you've done this, you can then save the previous ustr
value (a javascript global variable is an easy place to put this, or you could re-read the src
attribute from the image tag itself), and only update the image tag if the value actually changes.
If you must keep this nasty innerHTML blasting code, then I'd suggest checking the headers that your webserver sends when the browser downloads avatar.php
. My guess is that you are not setting any Cache headers, and so the browser won't cache previous images.