Plenty of good info, Chuck! Thank you! And many thanks to Jeff Johnson too!
I tried 'Cache-Control: no-cache' and 'Pragma: no-cache' but they did not
seem to work for my MSIE 5.5. I wanted to avoid the MSIE trick Jeff pointed
me to. So I tried 'Expires: 0' and that seemed to do the trick.
Now an important question remains: Did I do it in the right piece of Webware
code? I want all my pages to have this behaviour so I decided to do it in
the Page class of Page.py:
def respondToGet(self, transaction):
''' Invokes _respond() to handle the transaction. '''
# self._response.setHeader('Cache-Control', 'no-cache') # DDG\fge: Does
not work, at least not for MSIE 5.5
# self._response.setHeader('Pragma', 'no-cache') # DDG\fge: Does not
work, at least not for MSIE 5.5
self._response.setHeader('Expires', '0') # DDG\fge: Works, at least
not for MSIE 5.5. But is this the rite place to do it?
self._respond(transaction)
def respondToPost(self, transaction):
''' Invokes _respond() to handle the transaction. '''
# self._response.setHeader('Cache-Control', 'no-cache') # DDG\fge: Does
not work, at least not for MSIE 5.5
# self._response.setHeader('Pragma', 'no-cache') # DDG\fge: Does not
work, at least not for MSIE 5.5
self._response.setHeader('Expires', '0') # DDG\fge: Works, at least
not for MSIE 5.5. But is this the rite place to do it?
self._respond(transaction)
Anything wrong with this? Probably I should have placed it in a subclass of
Page. But I don't think that I should have done it in HTTPResponse.py or in
the adapters or servers. Page or its subclasses looks o.k. for me. Right?
BTW: Those HTTP-Headers could be set directly in IIS 4.0 as well. But I
think that should not be the way how to do it, it should be the app doing
it.
Best regards
Franz GEIGER
> -----Ursprüngliche Nachricht-----
> Von: Chuck Esterbrook [mailto:echuck@...]
> Gesendet: Dienstag, 20. März 2001 16:48
> An: fgeiger@...; Webware-discuss
> Betreff: Re: [Webware-discuss] How to switch off or circumvent browser
> caching?
>
>
> At 02:33 PM 3/20/2001 +0100, F. GEIGER wrote:
> >Hi all,
> >
> >I'm currently building a web shop with Webware (BTW a great
> pleasure if one
> >uses Webware).
> >
> >If I browse the few shop pages I already have with the browser's cache
> >activated I always have to press the browser's refresh button
> (F5 on MSIE).
> >How can I handle this from within Webware? Telling the browser that the
> >content has expired? How do YOU handle this?
> >
> >Thanks in advance and best regards
> >Franz GEIGER
>
> You're about one step ahead of me, so I haven't handled this yet, but let
> me point the way:
>
> First of all, the issue of caching is a general web application issue
> independent of WebKit and the solution for which, I am confident, is an
> HTTP header issue. (And not Webware, or HTML content which isn't normally
> read by proxy servers.)
>
> With that in mind I did some generic research on the issue and
> came up with
> the following. Franz, please let us know what you end up using:
>
>
> [1] The text at this page has links to an intro and a tutorial:
> http://www.web-caching.com/
>
>
> [2] "HTML META tags are unreliable for caching purposes, as they are not
> seen by intermediate proxies and do not have to be followed. The only way
> to affect caching is to have the HTTP headers set appropriately"
>
> http://www.web-caching.com/forums/Forum1/HTML/000016.html
>
>
> [3] I discovered some interesting HTTP headers:
> Cache-Control: no-cache
> Expires: 0
> Pragma: no-cache
> at http://www.wired.com/news/topstories/0,1287,1042,00.html
>
>
> With some more reading and experimentation I think you'll have a
> definitive
> solution (that you can share with the rest of us). It may be as simple as
> using one of those headers.
>
> -Chuck
>
>
|