Jump to content

Browser loading from cache


This topic is 6666 days old. Please don't post here. Open a new topic instead.

Recommended Posts

One problem I am noticing while working with XSL is the browser's tendancy to load a page from cache, when I need it to be making another query to the database.

For example, if I have the user scrolling through records, it will query the database the first time I view these records. But, if I navigate to the same record more than once, it is only loading the page from cache, and not querying the database again. This is a problem if a script or something else has modified that record.

This problem is also occuring on a page where the user can click a link which executes a script. If the link is clicked once, it works. Any additional clicks and the browser just reloads the same page from cache, which doesn't send the request to FileMaker to execute the script again.

What is a good way to ensure that everytime I give the browser a URL, it will always execute the query instead of loading from cache?

Link to comment
Share on other sites

There are three "caches" that can interfere the way of your document to the web browser:

1) the cache of the web server software

2) a possible intermediate proxy server

3) the cache of the web browser of the client

With respect to 1), the FMSA CWP Guide gives a clear hint: Turn it off, don't use it with FMSA. For Apache and Mac OS X (Server), this means to turn off the webperfcache. For IIS, I don't know (I am a "Maccie"), but you will find it out.

With respect to 2) and 3), things are a little bit more complicated. Some use the html tags (the poor man's solution) to control the cache behavior of the browser (3), but this won't help if there is an intermediate proxy server (2).

You can control 2) and 3) only by modifying the HTTP header that is sent to the client on the server side.

This is under your control by the fmxslt:set_header() extension function and the <?xslt-cwp-buffer buffer-content="true"?> processing instruction you need in conjunction with fmxslt:set_header(). Please consult pp. 58 and 62 of the FMSA CWP Guide for these.

Not all browsers understand HTTP 1.1. Therefore you must modify and send all headers at once to expire the cache for HTTP 0.9, 1.0, and 1.1. These are:

Expires: Date (date in HTTP format, e.g. Thu, 01 Dec 2004 18:00:00 GMT) for HTTP 0.9 and greater

Pragma: no-cache for HTTP 1.0

Cache-Control: private,no-cache,no-store for HTTP 1.1

The private directive tells the browser shared caches no to give content to other users.

no-cache tells the browser not to return cache content without first revalidating with the server.

no-store tells the proxy server not to save content persistently.

I.e. for the pages that should not be cached, insert fmxslt:set_header extension functions with Expires, Pragma, and Cache-Control.

Link to comment
Share on other sites

This topic is 6666 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.