I like this method too, since it puts the work on PHP instead of _javascript_, but unfortunately, in this case, I do not control the image generating script.
 
m.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich
Sent: Monday, November 13, 2006 8:34 PM
To: jQuery Discussion.
Subject: Re: [jQuery] Refresh an image with dynamic src URL?

On 11/13/06, Blair Mitchelmore <[EMAIL PROTECTED]> wrote:
If you want to defeat the cache you could try appending the current time
as a query string:

img.src = "" + "?" + (new Date()).getTime();

-blair

Another solution would be to, in your image generating script, send HTTP headers that tell the browser not to cache the file.

Here's the PHP code that would it:

header('Pragma: public');
header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: no-store, no-cache, must-revalidate');

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to