Often when I have written a page in php i can't use the back- and forward button in the browser. I think it have something to do with a http-header sent to the client. But I haven't figgured it out yet.
Someone care to explain how it works and how I can prevent this?
Using browser back button
Moderator: General Moderators
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
Then, you must send one of these headers?
either you get rid of those, (not recommended) or you accept that user can sometimes get that message. I really haven't educated myself enough that I could tell what you must do, but dynamic webpages are not supposed to be cached, as they might have changed. (But user can't see changes because page is loaded from old cache...)
hope that helped
-9902468
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
Then, you must send one of these headers?
either you get rid of those, (not recommended) or you accept that user can sometimes get that message. I really haven't educated myself enough that I could tell what you must do, but dynamic webpages are not supposed to be cached, as they might have changed. (But user can't see changes because page is loaded from old cache...)
hope that helped
-9902468
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact: