NYCPHP Meetup

NYPHP.org

[nycphp-talk] Prevent (IE) browser cache of image

Aaron Fischer agfische at email.smith.edu
Fri Apr 6 14:13:06 EDT 2007


Using time() to add a unique string to the img src seems to work  
quite well, thanks!

I think I prefer this to the nocache solution which gets applied to  
all page elements.

This example will only prevent caching of the one image, so all other  
items on the page can be cached, which I don't mind.  Will help the  
page load faster, particularly beneficial for users on a slower  
connection.

Cheers,

-Aaron

> Just add a unique string to the URL of the image
>
> <img src="createImg.php?<?php echo time(); ?>" />
>
> So the URL of the string changes every time the user reloads the page
>> How can I force IE to load a fresh version of the image, either  
>> via PHP or HTML/HTTP code?
>>
>>




More information about the talk mailing list