Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q416 How can I force a reload of an image from the server if the image already exists in the browser's cache?

irt.org | Knowledge Base | JavaScript | Image | Q416 [ previous next ]

Q416 How can I force a reload of an image from the server if the image already exists in the browser's cache?

By adding a different search string value after the image href. The following reloads the image from the server every 10 seconds:

<img src="picture.gif" name="myImageName">

<script language="JavaScript"><!--
function reloadImage() {
    var now = new Date();
    if (document.images) {
        document.images.myImageName.src = 'picture.gif?' + now.getTime();
    }
    setTimeout('reloadImage()',10000);
}

setTimeout('reloadImage()',10000);
//--></script>

Feedback on 'Q416 How can I force a reload of an image from the server if the image already exists in the browser's cache?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.