SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
-
Sep 3, 2002, 16:51 #1
- Join Date
- Jan 2002
- Location
- Saint Petersburg
- Posts
- 246
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Preventing a page from being cached in history
Hi.
I used .htaccess to create my own custom error page, error.php. It adds page requests that generate errors to a database table or, if the correct page is in the database, redirects the visitor to the correct page with a witty remark. What I've found is that when the user starts clicking back, it relogs the error.
How do I keep a page from being cached in browser history so that when you click back, it goes to the page before you went to the error page instead of the error page?Pants.
Join the NYFlava Fashions Contest
-
Sep 3, 2002, 17:51 #2
- Join Date
- Aug 2002
- Location
- Commonwealth of Pennsylvania
- Posts
- 232
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think it's (remember, I *think*):
PHP Code:header("Cache: no-cache");
-
Sep 3, 2002, 18:13 #3
- Join Date
- Jan 2002
- Location
- Saint Petersburg
- Posts
- 246
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally posted by Agent Dwarf
I think it's (remember, I *think*):
PHP Code:header("Cache: no-cache");
Pants.
Join the NYFlava Fashions Contest
-
Sep 3, 2002, 18:15 #4
To support different standards and clients you will need a bit more than that:
PHP Code:header("Expires: Mon, 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");
SeanHarry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature
-
Sep 3, 2002, 18:16 #5
Hang on - do you mean stop the browser displaying the name of the error page?
SeanHarry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature
-
Sep 11, 2002, 12:36 #6
- Join Date
- Jan 2002
- Location
- Saint Petersburg
- Posts
- 246
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It doesn't prevent it from being cached in history.
Anyone else with any ideas?Pants.
Join the NYFlava Fashions Contest
-
Sep 12, 2002, 10:59 #7
- Join Date
- Jul 1999
- Location
- Derbyshire, UK
- Posts
- 4,411
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The history is client side and there are no standards for stopping a page appear in the browser history, so you are very unlikely to be able to do it.
Karl Austin :: Profile :: KDA Web Services Ltd.
Business Web Hosting :: Managed Dedicated Hosting
Call 0800 542 9764 today and ask how we can help your business grow.
-
Sep 12, 2002, 11:47 #8
- Join Date
- Mar 2001
- Location
- London | UK
- Posts
- 1,140
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is this for one page or for all pages?
If it's just for one link you could make the link from a form that submits a hidden field via post. In the new apge, set a session/cookie var that says the page has been viewed. When the browser goes back you'll get an error that the page has expired. If the user re-submits the form you can check if the data is in the session/cookie and if it is....exit();
Obviously this isn't really an option for lots of pages, but for one it might work.
Matt.
Bookmarks