Re: Problem with IE7 caching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 7, 2010, at 2:06 PM, Charlene Wroblewski wrote:

I have a problem with IE7. It has a tendency to cache output produced by PHP. It occurs in a few ways:

   * I make a minor change to a php program, but you can't see it in
     IE7, but can in FF.  CTRL-Refresh does not make it work.
   * I modify data using a form in IE7.  When I click on a link to
     return to the form the old data is still there, but if I hit
     CTRL-Refresh the new values are there.

I have set up some caching to try to fix the second issue, but I'm not sure if I've chosen the right header lines:

  $now = time ();
  $prety_lmtime = gmdate ('D, d M Y H:i:s', $now). ' GMT';
  $prety_emtime = gmdate ('D, d M Y H:i:s', $now + $interval). ' GMT';
   // Backwards Compatibility
   header ("Last Modified: $prety_lmtime");
   header ("Expires: $prety_emtime");
   // HTTP/1.1 Support
   header ("Cache-Control: private, max-age=$interval,s-maxage=0");

I got this code from a book. I don't want to prevent caching completely because I want to be able to go back to the form when there is an error in validation of fields before entering it into the db. But I do want to be able to see the new data after it is entered in the db.

Charlene

Sounds like you need attach the data somehow when hitting that return link. Maybe an array
$newData = array();//fill this array with the new values

On your form page, set up a

if(isset($newData)){
//fill form fields
}

I did notice that on your header, you did not have "no-cache".

header ("Cache-Control: private, no-cache, max-age=$interval,s- maxage=0");

HTH


Karl DeSaulniers
Design Drumm
http://designdrumm.com


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux