Re: Problem with IE7 caching

From: Date: Sat, 08 May 2010 03:35:00 +0000
Subject: Re: Problem with IE7 caching
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-305005@lists.php.net to get a copy of this message
Karl DeSaulniers wrote:
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"); Actually, I should have looked at which caching code I was using for the second problem. This is the code:
               header ("Expires: 0");
               header ("pragma: no-cache");
               // HTTP/1.1 Support
               header ("Cache-Control: no-cache,no-store,max-age=0,s-maxage=0, must-revalidate");
About storing the values, I really would rather the browser keep track of form input if I can. It could get confusing trying to store temporary information, especially since the form is being used to modify a client profile as well as create a new password for the first time in the application (not my choice - I'd rather do passwords first and then allow them to modify info). Charlene

« previous php.general (#305005) next »