I have provided limited access to an existing Notes application for web users, but am finding that my browser, which is IE7, seems to cache the pages so that, for example, if you create a new Document, then click on a link to a View that displays that Document, it doesn’t display unless you press F5. This is especially annoying as I’ve used frames, so pressing F5 actually goes back to the initial frameset. So instead you must right-click the frame in which the document is displayed, & click on the Refresh item in the pop-up menu.
I’ve just carried out a quick search on Google & elsewhere and was a bit surprised to see so many pages explaining different methods to do this, along with comments that most of them don’t work! Having said that, a fairly simple solution will work in this case, & if necessary, it could apply to all pages within the site - if the odd static page had to be reloaded each time, then that wouldn’t be a major problem.
Subject: I am ‘webifying’ an existing Notes application, but I’m finding my browser (IE7) keeps caching old copies of pages - how can I stop this from happening?
@SetHTTPHeader(“Cache-control”;“no-cache”) – that will prevent both local (browser) cacheing and proxy server cacheing.
Subject: RE: Where would I put the @SetHTTPHeader command?
Not exactly.
First, I thinks it’s wrong. The content for http-equiv expires must be a string representing a number, not no-cache. So, “0” would be a valid content. There is another http-equiv called pragma, which can be set to “no-cache”, but this is intended for proxies, only. Maybe you (or the guy who told you) mixed those ones up.
But still it doesn’t exactly the same. The HTTP header is evaluated before the document is loaded, stuff in the HTML head is not. Also, it is not visible to caches along the line, like proxy servers. So, Stan’s advice is definitely better (as long as there aren’t any old HTTP 1.0 components in the chain.
Take a little care for where to place the formula. In theory, it works almost everywhere: (hidden) computed for display fields, computed text, HTML Head Content event of the form (don’t get confused, it still adds an HTTP header). However, a computed text executing this formula must not be hidden using Notes hide-when-formulas, so a cfd field is easier to manage.
It has also been reported in this forum, that @SetHttpHeader will introduce line breaks, if the content you provide is very long, unless you place it into HTML Head Content. Should not be an issue here (and in most cases), though.
Subject: RE: Where would I put the @SetHTTPHeader command?
Let me put it like this: If it was the best thing to do, Stan would have mentioned it.
It doesn’t hurt. It adds a few more characters to the HTML, but that’s usually not something to care about if we let Domino generate the HTML, anyway. To be on the save site, you can put in both.
What surprises me a bit is, that you’re having problems with caching in the first place. Caching is not necessarily bad, it helps to improve performance massively. Of course, that doesn’t help, if you don’t get to see changes. For each page, Domino generates a piece of information transmitted in the HTTP header, called an etag. If this header is present, browsers usually do a follow-up request of the same resource in a way that includes a check against this tag and a modified date.
Most of the time, this works pretty well. You can check IEs caching options and see if reloading is set to automatic. Anyhow, if up to date data is more important then top notch performance, it’s certainly OK to include the above stuff in the $$ViewTemplate for your view(s).
Subject: RE: Where would I put the @SetHTTPHeader command?
It doesn’t hurt, no, but it doesn’t work if there’s a proxy server in the way, either, since most proxies only read the REAL header. The tag is a way to force the browser to act as if the info is in the header. If there’s nothing between your browser and the server, works just fine, but if there’s a proxy in the way, your browser will dutifully request the newest version, and the proxy will dutifully serve it the version it has in cache.
Subject: RE: Where would I put the @SetHTTPHeader command?
I thought the @SetHTTPHeader could work, but I’ve never tried it. The most common problem is that people don’t know how to configure their IE, since by default it auto-refreshes only on IIS servers, users MUST press F5 after each page is loaded (it does say so also in the IE help, which probably nobody ever reads).
But I found a solution which works on every misconfigured browser and proxy server, and gets rids of the need to press F5 after each page in IE: just add with JavaScript an random number to each URL, like:
Subject: RE: Where would I put the @SetHTTPHeader command?
“since by default it auto-refreshes only on IIS servers, users MUST press F5 after each page is loaded (it does say so also in the IE help, which probably nobody ever reads).”
I can’t find this information anywhere in IE6 or IE7 online help. Could you provide me with a reference?
Subject: RE: Where would I put the @SetHTTPHeader command?
It was apparently removed from IE7, but it seems still to work in IE6 on a Windows 2003 Server: press F1 when you are in the Tools/Internet Options/General/Temporary Internet files/Settings/Automatically, and you will get this text:
"Specifies that when you return to a page you viewed previously, Internet Explorer should not check to see whether the page has changed since you last viewed it.
If you select this, Internet Explorer will check for new content only when you return to a page that was viewed in an earlier session of Internet Explorer or on an earlier day. Over time, if Internet Explorer determines that images on the page are changing infrequently, it will check for newer images even less frequently.
Selecting this option can provide the most speed when browsing through pages you have already viewed.
If you want to see the most current version of a specific page, even when this option is selected, return to the page, and then click the Refresh button on the toolbar."
The info about IIS only compatibility when using the “Automatically” setting (which is default) was somewhere on the Microsofts pages.
Subject: RE: Where would I put the @SetHTTPHeader command?
Paul asked for using both, the real header and the meta tags together. In this case the proxy must obey and not change the header when transferring the response to the requesting user agent, so I don’t see a problem with that. It’s not necessary, but still I think it doesn’t hurt.
Since HTTP 1.0 didn’t specify the cache-control header, it might even be beneficial to have the no-cache pragma (which is actually meant to be used by proxy servers), if there is an old proxy somewhere in the chain. Do you disagree?
Subject: I am ‘webifying’ an existing Notes application, but I’m finding my browser (IE7) keeps caching old copies of pages - how can I stop this from happening?
You can also set server side Http response header rules for “Expires” and “Cache-control” http headers. Seach the admin help for “rules” and you will find how to create and set up response headers to manage browser caching.