|HOWTO: Force image refresh |
A page containing an image with a fixed name such as
is usually displayed with a cached version of photo.jpg even after a new image
under the same name is uploaded to the server.
This article offers a simple trick to force an image refresh.
To force an image refresh, the SRC attribute of the <IMG> needs to assume a new and unique value
with every page refresh.
Since the image name is fixed, the changing part should be appended
to the filename with the ? character used as a delimiter.
In VBScript, the Rnd and Randomize functions can be used to ensure uniqueness, for example:
<IMG SRC="images/photo.jpg?<% = Rnd %>">
Created: 3/7/2007 6:30:41 PM
Last Modified: 3/7/2007 6:30:41 PM
Copyright © Persits Software, Inc. 1998 - 2018
For technical support, write to firstname.lastname@example.org.