Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | JavaScript | Image | Q416 [ previous next ]

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?'

©2018 Martin Webb