Page 1 of 1

Refresh problems

Posted: Mon Feb 27, 2006 7:37 pm
by evilmonkey
Hello,

My website uses a script that lets a user upload his/her own pictures. Each user can upload to a maximum of six pictures. The pictures are named as following: userindex_pictureindex. So the fourth picture of the user identified with id 556 will be 556_4.jpg. The users can change any of thier six pictures, and it immediately gets update on thier profile. The user profile only shows thumbnails, and once those thumbnails are clicked, a full-size pic opens in a DHTML window. This presents a problem: after a picture was changed, the thumbnail get updated (once the profile is reloaded), but the full-size image gets pulled from the user's cache, hence it shows the older picture (a pic that was already replaced). The only way to circumvent that is to manually hit the browser refresh button, only then the new pics get downloaded. I put this line of code on the profile page, but it still couldn't solve the problem:

Code: Select all

echo '<meta http-equiv="no-cache">';
Is there some way I can block the cache, or force the browser to download the data on each loading of the page? Will ithelp the full-size pics (those technically aren't on the page, the DHTML window just shows a jpeg image). Any help is appreciated.

Thanks. :)

Quick, dirty solution

Posted: Mon Feb 27, 2006 7:55 pm
by zeek
If you just want a quick, dirty solution...

Add a meaningless variable set with a random value to the url. The random value should be reset each time. Like...

picture_page.htm?ignore=36523

Posted: Mon Feb 27, 2006 8:21 pm
by evilmonkey
Umm...I'd rather do a more user friendly solution and not throw more garbage into the URL bar...This will probably the page that's most frequently linked to.

make it pretty then...

Posted: Wed Mar 01, 2006 2:26 pm
by zeek
evilmonkey wrote:Umm...I'd rather do a more user friendly solution and not throw more garbage into the URL bar...This will probably the page that's most frequently linked to.
lol, I'm not sure how passing a var in the url makes it less user friendly. 'ignore' was just an example. If you think it looks like junk do something like... ?nochache=4653 or ?x=4875