Click to See Complete Forum and Search --> : Back and forth


Webskater
07-08-2003, 06:07 AM
Two related things ...

Some sites definitely prevent you from using the Back button. Instead the previous page reloads. How do they do that?

Also, is there a way to completely and absolutely prevent client-side caching - so that, in no circumstances, is a page fetched from the cache instead of from the server.

Thanks for any answers.

Charles
07-08-2003, 06:10 AM
I'm not exactly sure what you are describing in your first question but there's no way you can be absolutely sure that a browser does anything that you want. Your best bet, however, is to send an HTTP Response header with an Expires field with a value sometime in the past.

Webskater
07-08-2003, 08:42 AM
In the first part of my question I meant:

When you click the back button on some sites (ft.com for example) the previous page always reloads - it is not fetched from the client side cache.

Khalid Ali
07-08-2003, 09:25 AM
Do you get an error that tells you that its been reloading no from the cache but from the webserver???

Webskater
07-08-2003, 10:10 AM
No, there are no errors but you can see the page being re-fetched from the server. On my site I have lots of pages that only change by virtue of the fact that the database has changed. I notice that, sometimes, if I click the Back button, or, if I use an expression like window.location.reload(), a cached page appears. I have response.expires = Now()-1 and all sorts of other expressions (pragma no-cache expires.Absolute etc etc) but still the browser loads a cached version. I am under the impression that all the stuff about http headers and pragma no-cache etc. is designed to tell the server not to send a cached version of the page. I want the client to always request a new version of a page and never fetch one from the client-side cache.