faqts : Computers : Programming : Languages : PHP : Common Problems : Caching

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 3 people (67%) answered Yes
Recently 2 of 3 people (67%) answered Yes

Entry

I cannot prevent caching. I have tried many solutions... still caches.

Mar 27th, 2006 16:56
Jacob OD,


Sorry, wouldn't let me add more in title.  I have tried adding <META
HTTP-EQUIV="Pragma" CONTENT="no-cache"> in the header.  I made it so
when you choose the new picture it would add a dummy get variable to
trick the browser into thinking it is a new page (ie:
my_profile.php?rand=43845)

I also tried setting this header
  header("Cache-Control: no-cache, must-revalidate"); 
  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  header("Location: my_profile.php?rand=$rand"); 
(this redirects the page back to the profile page after I have chosen a
new picture).

This occurs occasionaly, but happens most frequently when I have never
selected the picture to be the picture on the profile page.