Browser keeps caching
am 06.09.2007 10:21:00 von itsramon
Hi,
I have a problem with Internet Explorer (v7). It's not my favorite browser,
but you do have to test your websites in it.
In my browser, I have selected the cache option "Every time I visit the
website".
In the PHP code I included:
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Expires: Mon, 1 Jan 2000 00:00:00 GMT"); // Date in the past
header("Pragma: no-cache");
Still I need to refresh the page with Ctrl-F5, pressing just F5 returns an
old version of the page.
Do I miss something here?
Thanks,
Ramon.
Re: Browser keeps caching
am 06.09.2007 16:12:39 von Steve
"news.xs4all.nl" wrote in message
news:46dfb86a$0$229$e4fe514c@news.xs4all.nl...
> Hi,
>
> I have a problem with Internet Explorer (v7). It's not my favorite
> browser, but you do have to test your websites in it.
>
> In my browser, I have selected the cache option "Every time I visit the
> website".
> In the PHP code I included:
>
> header("Cache-Control: no-store, no-cache, must-revalidate");
> header("Cache-Control: post-check=0, pre-check=0", false);
> header("Expires: Mon, 1 Jan 2000 00:00:00 GMT"); // Date in the past
> header("Pragma: no-cache");
>
> Still I need to refresh the page with Ctrl-F5, pressing just F5 returns an
> old version of the page.
>
> Do I miss something here?
>
> Thanks,
> Ramon.
i'm not sure this is still an issue with IE, but their website used to say
that to 'ensure' a page wasn't cached in IE you would need to set the
headers and at the bottom of the page somewhere, include a meta tag for
cache as well. they gave a long explanation for this, but i really don't,
nor care to, remember. it's just one of those things you have to work with.
either way and having said all of that, there is NO guarantee in ANY browser
that your server's request to not cache a page's content will be honored.
Re: Browser keeps caching
am 06.09.2007 19:55:19 von Shion
news.xs4all.nl wrote:
> Hi,
>
> I have a problem with Internet Explorer (v7). It's not my favorite
> browser, but you do have to test your websites in it.
>
> In my browser, I have selected the cache option "Every time I visit the
> website".
> In the PHP code I included:
>
> header("Cache-Control: no-store, no-cache, must-revalidate");
> header("Cache-Control: post-check=0, pre-check=0", false);
> header("Expires: Mon, 1 Jan 2000 00:00:00 GMT"); // Date in the past
> header("Pragma: no-cache");
>
> Still I need to refresh the page with Ctrl-F5, pressing just F5 returns
> an old version of the page.
>
> Do I miss something here?
Beyond the fact that MSIE7 is yet more buggy than previous versions, you
should never count on that a browser or proxy won't cache even if you tell it
to not do so in the headers/meta-tags, there still user settings which you
never will be able to control.
--
//Aho
Re: Browser keeps caching
am 07.09.2007 06:05:01 von Ravindra
the best way to avoid cache is to append a dummy parameter in all your
requests sent to the server
like
say you have url http://www.yourdomain.com/page.php?id=123&someparameter=aaa
then append that url with a dummy parameter which will have a random
value like ....
"http://www.yourdomain.com/page.php?
id=123&someparameter=aaa&dummy=".rand()
this should ask browser to send request to the server and fetch new
response..
but still images and other things in the page would be cached on the
browser side...if u want to avoid that follow the same procedure for
all the request to the server...
--ravi