Re: [PHP] Internet Explorer Caching
Satyam wrote: I'm sending these headers: header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past I don't remember where I took them from, but they are working fine for me. Probably not relevant to the problem, but 26 Jul 1997 was a Saturday not a Monday. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Internet Explorer Caching - Solved
Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Pragma, no-cache); header(Expires, -1); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Charlene I am using sessions, and it appears to work differently in PHP5 than PHP4 (not fully tested as to verification of that statement). So I needed to add a line of code before the session_start function: session_cache_expire(0); session_start(); Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Internet Explorer Caching
Here are some cache things we do for IE... // workaround for IE bug that prevents downloading files from an httpS site // (see http://support.microsoft.com/default.aspx?scid=kb;en-us;316431 ) session_cache_limiter('public'); // This ensures that most browsers known to human beings won't try to cache the page. // Proxy caching is, I believe, somewhat addressed by the cache-control, but // additional directives exist should that ever become a concern. header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);// Date in the past header(Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // always modified header(Cache-Control: no-store, no-cache, must-revalidate); // HTTP/1.1 header(Cache-Control: post-check=0, pre-check=0, false); header(Pragma: no-cache); // HTTP/1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Internet Explorer Caching
I've been having problems with Internet Explorer caching php programs. I'm using the following code: header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Pragma, no-cache); header(Expires, -1); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Pragma, no-cache); header(Expires, -1); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Are you sure? By default PHP pages/scripts don't send any caching headers and hence don't get cached. You can check this using: http://www.fiddlertool.com -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
I'm sending these headers: header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past I don't remember where I took them from, but they are working fine for me. Satyam - Original Message - From: Richard Heyes [EMAIL PROTECTED] To: Charlene [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, August 29, 2007 5:50 PM Subject: Re: [PHP] Internet Explorer Caching Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Pragma, no-cache); header(Expires, -1); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Are you sure? By default PHP pages/scripts don't send any caching headers and hence don't get cached. You can check this using: http://www.fiddlertool.com -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.484 / Virus Database: 269.12.10/977 - Release Date: 28/08/2007 16:29 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
that's from php.net... PHP scripts often generate dynamic content that must not be cached by the client browser or any proxy caches between the server and the client browser. Many proxies and clients can be forced to disable caching with: ?php header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); // Date in the past ? Note: You may find that your pages aren't cached even if you don't output all of the headers above. There are a number of options that users may be able to set for their browser that change its default caching behavior. By sending the headers above, you should override any settings that may otherwise cause the output of your script to be cached. Additionally, session_cache_limiter() and the session.cache_limiter configuration setting can be used to automatically generate the correct caching-related headers when sessions are being used. On 8/29/07, Satyam [EMAIL PROTECTED] wrote: I'm sending these headers: header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past I don't remember where I took them from, but they are working fine for me. Satyam - Original Message - From: Richard Heyes [EMAIL PROTECTED] To: Charlene [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, August 29, 2007 5:50 PM Subject: Re: [PHP] Internet Explorer Caching Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Pragma, no-cache); header(Expires, -1); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Are you sure? By default PHP pages/scripts don't send any caching headers and hence don't get cached. You can check this using: http://www.fiddlertool.com -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.484 / Virus Database: 269.12.10/977 - Release Date: 28/08/2007 16:29 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- -Nate http://swapinvites.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
On Wed, August 29, 2007 10:43 am, Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Pragma, no-cache); header(Expires, -1); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. The second argument to header() function will allow you to send duplicate headers for the same header-name. header(Pragma: no-cache); header(Pragma: must-revalidate); This is usually NOT what you want for headers, as MOST of them allow only ONE instance. So header(Pragma, no-cache); is sending a SECOND Pragma header. Actually, as you have no : in there, it probably is sending it with no :, so it's really the first completely bogus Pragma header which is doing absolutely nothing, and isn't a Pragma: header at all. I guess technically it's maybe not bogus... You're allowed to extend the HTTP protocol and send extra headers, but they're supposed to start by X- by convention... //legit header(X-my-custom-header: 42); //certainly not convention; probably not legit header(My-custom-header: 42); But it's sure not the Pragma: no-cache header you MEANT to send. Ditto for Expires. And double-ditto for the -1 value for Expires, which I do not think is a valid value. Now IE may have decided to stop doing an interpretive dance around the bogus headers you have been sending, and has decided it's time to make you send the REAL headers. Personally, I think it should never have let you get away with it in the first place, but that's IE for ya. ULTIMATELY, however, if you really really really want MS IE nor any intermediary servers to cache something, your best bet is to add some random bit to the URL: ?php $ms_sucks = md5(uniqid(mt_rand(), 1));? a href=whatever.php?ms_sucks=?php echo $ms_sucks?can't cache this/a There is no combination of headers for no-cache that will actually WORK for *ALL* legacy browsers. Please Note: When I say *ALL* legacy browsers, I'm including everything back to NCSA Mosiac and corporate re-branded IE with their own nifty logo in place of the IE logo. ATT, for example, does/did this for their employees -- and the version number may match exactly with the publicly-available IE, but they don't behave the same, in my experience. :-( Given that it's a heck of a lot easier to generate a random URL than fiddle with so-called no-cache headers every time a bug report from some browser you never even heard of rolls in, I strongly recommend using a random URL. YMMV -- Please vote for this great band: http://acl.mp3.com/feature/soundandjury/?band=COMPANY-OF-THIEVES Requires email confirmation. One vote per day per email limit. Obvious ballot-stuffing will be revoked. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
Yes, I'm sure. Changes I make to a database are reflected in the database but not on the form. It's only IE. It works fine in FireFox or SeaMonkey. Charlene Richard Heyes wrote: Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Pragma, no-cache); header(Expires, -1); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Are you sure? By default PHP pages/scripts don't send any caching headers and hence don't get cached. You can check this using: http://www.fiddlertool.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
I forgot to mention in my question that only IE appears to cache. And with the way my PHP program goes, I'm constantly changing the URL as I go through the application to modify data and status message. But whenever I return the the edit page, the old data is showing up. Charlene Richard Lynch wrote: On Wed, August 29, 2007 10:43 am, Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Pragma, no-cache); header(Expires, -1); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. The second argument to header() function will allow you to send duplicate headers for the same header-name. header(Pragma: no-cache); header(Pragma: must-revalidate); This is usually NOT what you want for headers, as MOST of them allow only ONE instance. So header(Pragma, no-cache); is sending a SECOND Pragma header. Actually, as you have no : in there, it probably is sending it with no :, so it's really the first completely bogus Pragma header which is doing absolutely nothing, and isn't a Pragma: header at all. I guess technically it's maybe not bogus... You're allowed to extend the HTTP protocol and send extra headers, but they're supposed to start by X- by convention... //legit header(X-my-custom-header: 42); //certainly not convention; probably not legit header(My-custom-header: 42); But it's sure not the Pragma: no-cache header you MEANT to send. Ditto for Expires. And double-ditto for the -1 value for Expires, which I do not think is a valid value. Now IE may have decided to stop doing an interpretive dance around the bogus headers you have been sending, and has decided it's time to make you send the REAL headers. Personally, I think it should never have let you get away with it in the first place, but that's IE for ya. ULTIMATELY, however, if you really really really want MS IE nor any intermediary servers to cache something, your best bet is to add some random bit to the URL: ?php $ms_sucks = md5(uniqid(mt_rand(), 1));? a href=whatever.php?ms_sucks=?php echo $ms_sucks?can't cache this/a There is no combination of headers for no-cache that will actually WORK for *ALL* legacy browsers. Please Note: When I say *ALL* legacy browsers, I'm including everything back to NCSA Mosiac and corporate re-branded IE with their own nifty logo in place of the IE logo. ATT, for example, does/did this for their employees -- and the version number may match exactly with the publicly-available IE, but they don't behave the same, in my experience. :-( Given that it's a heck of a lot easier to generate a random URL than fiddle with so-called no-cache headers every time a bug report from some browser you never even heard of rolls in, I strongly recommend using a random URL. YMMV -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
I had used something similar in another iteration of trying to fix the caching problem in IE. I tried these lines again, and they don't work. It is only IE that is caching. Charlene Satyam wrote: I'm sending these headers: header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past I don't remember where I took them from, but they are working fine for me. Satyam - Original Message - From: Richard Heyes [EMAIL PROTECTED] To: Charlene [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, August 29, 2007 5:50 PM Subject: Re: [PHP] Internet Explorer Caching Charlene wrote: I've been having problems with Internet Explorer caching php programs. I'm using the following code: header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header(Pragma, no-cache); header(Expires, -1); And it used to work, but now, according to Windows Explorer its giving it 3 hours to expire. Are you sure? By default PHP pages/scripts don't send any caching headers and hence don't get cached. You can check this using: http://www.fiddlertool.com -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.484 / Virus Database: 269.12.10/977 - Release Date: 28/08/2007 16:29 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
On Wed, August 29, 2007 2:10 pm, Charlene wrote: I forgot to mention in my question that only IE appears to cache. And with the way my PHP program goes, I'm constantly changing the URL as I go through the application to modify data and status message. But whenever I return the the edit page, the old data is showing up. Ah! old data as in This is what you typed into the form last time you were here, so this is what you must want in the form this time, no matter what is in the HTML for the default value, because we are Microsoft, and our users are stupid and this is what they want? You're pretty much dealing with a browser behaviour, I think, and people dumb enough to use IE actually expect it to work that way, and trying to fix it is probably a mistake. -- Please vote for this great band: http://acl.mp3.com/feature/soundandjury/?band=COMPANY-OF-THIEVES Requires email confirmation. One vote per day per email limit. Obvious ballot-stuffing will be revoked. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
Unfortunately I don't have a choice. I have to be able to handle IE. And IE is caching the page. I can see it in my Temporary Internet Files folder. And the Expiration Date is 3 hours after the file is created. If I delete the file, a new one is created and the Expiration Date is 3 hours after the new file is created. Charlene Richard Lynch wrote: On Wed, August 29, 2007 2:10 pm, Charlene wrote: I forgot to mention in my question that only IE appears to cache. And with the way my PHP program goes, I'm constantly changing the URL as I go through the application to modify data and status message. But whenever I return the the edit page, the old data is showing up. Ah! old data as in This is what you typed into the form last time you were here, so this is what you must want in the form this time, no matter what is in the HTML for the default value, because we are Microsoft, and our users are stupid and this is what they want? You're pretty much dealing with a browser behaviour, I think, and people dumb enough to use IE actually expect it to work that way, and trying to fix it is probably a mistake. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
Unfortunately I don't have a choice. I have to be able to handle IE. And IE is caching the page. I can see it in my Temporary Internet Files folder. And the Expiration Date is 3 hours after the file is created. If I delete the file, a new one is created and the Expiration Date is 3 hours after the new file is created. Charlene Richard Lynch wrote: On Wed, August 29, 2007 2:10 pm, Charlene wrote: I forgot to mention in my question that only IE appears to cache. And with the way my PHP program goes, I'm constantly changing the URL as I go through the application to modify data and status message. But whenever I return the the edit page, the old data is showing up. Ah! old data as in This is what you typed into the form last time you were here, so this is what you must want in the form this time, no matter what is in the HTML for the default value, because we are Microsoft, and our users are stupid and this is what they want? You're pretty much dealing with a browser behaviour, I think, and people dumb enough to use IE actually expect it to work that way, and trying to fix it is probably a mistake. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internet Explorer Caching
Charlene wrote: Unfortunately I don't have a choice. I have to be able to handle IE. And IE is caching the page. I can see it in my Temporary Internet Files folder. And the Expiration Date is 3 hours after the file is created. If I delete the file, a new one is created and the Expiration Date is 3 hours after the new file is created. Charlene Richard Lynch wrote: On Wed, August 29, 2007 2:10 pm, Charlene wrote: I forgot to mention in my question that only IE appears to cache. And with the way my PHP program goes, I'm constantly changing the URL as I go through the application to modify data and status message. But whenever I return the the edit page, the old data is showing up. Ah! old data as in This is what you typed into the form last time you were here, so this is what you must want in the form this time, no matter what is in the HTML for the default value, because we are Microsoft, and our users are stupid and this is what they want? You're pretty much dealing with a browser behavior, I think, and people dumb enough to use IE actually expect it to work that way, and trying to fix it is probably a mistake. It could be that your browser is overriding the cache settings. In IE go to Tools - Internet Options - General - (history)Settings make sure it is set to either Automatically or Every visit to the page if it is form data that keeps returning, go to Tools - Internet Options - Content - AutoComplete And make sure that Forms is not checked in the list of items Hope this helps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php