Page 1 of 1

Controlling Browser Cache

Posted: Tue Nov 27, 2001 10:13 am
by source1Tamer
Hi guys,
How do I control the browser cache so when the user hit the Back button, he will get "Web Page Expired" message or expired contents? I cannot use any client code.

thanks,
Tamer

Controlling Browser Cache

Posted: Tue Nov 27, 2001 10:56 am
by Kai
This is more of an HTTP question; you'd send headers like these:

Pragma: no-cache
Cache-Control: no-cache
Expires: 0

to tell the browser not to cache the page. In Vortex you would send these headers with the <header> function, making sure to do so before any output is printed:

<header NAME="Pragma" VALUE="no-cache">
<header NAME="Cache-Control" VALUE="no-cache">

Note that the browser likely won't say "Page expired" but will attempt to reload the page. Note also that that behavior of some browsers varies; some (like Netscape) will often cache an image regardless of these fields; some (like MSIE 4.0) have been known to lose the Content-Type of the document when these headers are sent.

The only guaranteed way we've found to get the browser to re-load pages, especially images, is to make the URL of each unique, eg. with a counter in the URL.

Controlling Browser Cache

Posted: Tue Nov 27, 2001 11:31 am
by source1Tamer
Thanks Kai,
I've added the 3 lines,this is working very good using the header function.
I couldn't make it work as I imagined with the message:
"Web Page Expiered" as I can do it in ASP...
,, but at least it's gonna re-query the database for every single page..
Perfect!