KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Setting the HTTP Header to prevent HTML page caching
PRODUCT: 4D | VERSION: | PLATFORM:
Published On: October 27, 2000

The following code takes advantage of the new 4D 6.7 syntax for the SET HTTP HEADER command to request that dynamic web pages sent from 4th Dimension web server not be cached by web browsers, proxy servers or other user-agents. This technique only works in Non-contextual Mode. Note that it is up to the user-agent whether or not these headers are respected.

Copy and Paste the following code into your own 4D project:
` enhanced cache controls by Eric Saltzen - 4D, Inc. Technical Support, Sept. 2000
` utilizing new 4D 6.7 syntax for SET HTTP HEADER (array parameters)
ARRAY TEXT(fieldArray;3)
ARRAY TEXT(valueArray;3)
fieldArray{1}:="Pragma" ` HTTP1.0 Standard
valueArray{1}:="no-cache" ` please don't cache me
fieldArray{2}:="Cache-Control" ` HTTP 1.1 Standard
valueArray{2}:="no-cache" ` please don't cache me
fieldArray{3}:="Expires" ` for user-agents that ignore above
valueArray{3}:="Sat, 20 Sep 2000 01:56:59 GMT" ` NOTE: 'Expires' could not be set prior to 4D v6.7
SET HTTP HEADER(fieldArray;valueArray)