Force image refresh

M

Marco Maroni

How to force image refresh on client browser ? Is ti possible to force the
refresh of the same image (tha was changed server-side) to the client,
without user press Contrl+F5 in IE ?

-
Marco
 
R

Ray Dixon [MVP]

Hi Marco,

There's not really a way to have the server tell the client to refresh the
page. However, the server can send information that tells the client to
refresh the page at a specific interval. There are a couple of ways to do
this. One way is to add a META tag to in the HEAD of the HTML sent to the
client. For instance, if you want the entire page to refresh every 2
seconds, you could add the following tag to inside the HEAD element:

<META HTTP-EQUIV="REFRESH" CONTENT=2>

You can also use client-side script to force a refresh. You could use a
combination of window.setInterval() and location.reload() to periodically
refresh the page.

window.setInterval:
http://msdn.microsoft.com/library/d...uthor/dhtml/reference/methods/setinterval.asp
location.reload:
http://msdn.microsoft.com/library/d...hop/author/dhtml/reference/methods/reload.asp

If you wanted to refresh the page only when the image is updated, I would
pursue perhaps having a hidden frame with a page that periodically checks to
see if the image has been updated since the last time it was loaded, then
refresh the entire page if it has.

Good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top