Jump to content

Page caching challenge

- - - - -

  • Please log in to reply
3 replies to this topic

#1
batowiise

batowiise

    Newbie

  • Members
  • PipPip
  • 17 posts
Hi All,

The following code i was told does not cache, it works fine sometimes and sometimes does not (caches). I do not want the page to cache.


header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");

header("Last-Modified: " . gmdate("D, d M Y H:i:s" ) . " GMT");

header("Cache-Control: no-store, no-cache, must-revalidate");

header("Cache-Control: post-check=0, pre-check=0", false );

header("Pragma: no-cache");


What might be the possible cause and fix to it? Your help is much appreciated.

Regards.

#2
SoN9ne

SoN9ne

    Programmer

  • Members
  • PipPipPipPip
  • 129 posts
That should work. What browser(s) are you experiencing caching with? I notice IE doesn't seem to obey this much. How about FireFox, Chrome, Opera, etc.. ?
"Life would be so much easier if we only had the source code."

#3
batowiise

batowiise

    Newbie

  • Members
  • PipPip
  • 17 posts
I am testing on Firefox. It sometime caches and probably especially when i open the browser before making changes to my XML file.

#4
SoN9ne

SoN9ne

    Programmer

  • Members
  • PipPipPipPip
  • 129 posts
Hmm, are you sure that no output is sent to the browser before these headers are applied? Make sure there is no white-space that is outputted before these headers are called. It should thrown an error if this is the case. Have you checked your logs to make sure that you were not getting any errors? Seems like a silly question but it's best to start at the basics. I never had an issue with FF caching when using these headers so I am concerned there may be another issue and it's not just the headers. Do you have any code you can supply so others (including myself) can take a look?
"Life would be so much easier if we only had the source code."




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users