Clinton Posted August 31, 2005 Posted August 31, 2005 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?
Martin Brändle Posted September 1, 2005 Posted September 1, 2005 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.
Clinton Posted September 1, 2005 Author Posted September 1, 2005 Wow, perfect. Exactly what I needed; fixes a lot of the troubles I have been having. Now, if I can just get a handle on these sessions...
Recommended Posts
This topic is 7021 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 accountSign in
Already have an account? Sign in here.
Sign In Now