Re: how to make the php page always newest when clicking 'back' botton in browser?
| From: | Brad Hubbard | Date: | Tue, 25 Sep 2001 10:52:11 +0000 |
| Subject: | Re: how to make the php page always newest when clicking 'back' botton in browser? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68680@lists.php.net to get a copy of this message | ||
On Tue, 25 Sep 2001 13:09, mydata wrote:
> Hi,I meet a problem when I am developing.
>
> I am developing php base on other programer's php code .
> I must make the php page always newest when clicking 'back' botton in
> browser(because that programer using javascript: history.go(-1)), I try
> sent header() to disable cach,but seems to not works:
> my development show below:
> I have two page: page1 and page2 , on page1 I have a form which used to
> send parameter to page2, when I submit this form ,the URL change to page2
> ,page2 use php code to deal with parameter and date submitted by form on
> page1 , then page use javascript: history.go(-1) to return page1 . and
> page1 must show newest information .
>
> I think it maybe not php questtion ,maybe I shoud insert some javascript
> code into page1 somewhere,but I don't know what to . Could somebody help me
> , thank you very much.
You're welcome.
// Function to disable caching of individual page
function Congo_nocache()
{
$dateHeader=time();
$expHeader=$dateHeader-60; // set expire date for 60 seconds ago
$modHeader=$dateHeader-3600; // set modified date for an hour ago
header("Date: " . gmdate("D, d M Y H:i:s",$dateHeader)."
GMT");
// Current
Date
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: " . gmdate("D, d M Y H:i:s",$expHeader)."
GMT");
// Date in
the past
header("Last-Modified: " . gmdate("D, d M Y
H:i:s",$modHeader)."
GMT"); //
always modified
header("Pragma: no-cache"); // HTTP/1.0
}
Sorry about the formatting (or lack of it :-)
Happy trails,
--
Brad Hubbard
Congo Systems
12 Northgate Drive,
Thomastown, Victoria, Australia 3074
Email: brad@congosystems.com
Ph: +61-3-94645981
Fax: +61-3-94645982
Mob: +61-419107559