Sometimes you just don't want a page to be cached, ever, by the client's web browser. This recipe tells you how to do that from DTML.
| 1 2 3 4 5 6 7 8 9 10 11 | From DTML:
<dtml-call "RESPONSE.setHeader('Cache-Control', 'no-cache')">
<dtml-call "RESPONSE.setHeader('Pragma', 'no-cache')">
From python/python script:
def noCache(self, REQUEST):
    REQUEST.RESPONSE.setHeader('Cache-Control', 'no-cache')
    REQUEST.RESPONSE.setHeader('Pragma', 'no-cache')
 | 
There are two things done here. The first is to set the "Cache-Control" header. This works on newer browsers. The second is to set the Pragma header. Older browsers use this one. A newer browser will ignore Pragma if Cache-Control is defined.
    Tags: web
  
  
      
 Download
Download Copy to clipboard
Copy to clipboard