[Javascript] Client Side anti-cache [was 1 MORE Question...]

Rodney Myers rodney at aflyingstart.net
Fri Jun 22 17:36:19 CDT 2001


Thanks Josiah,

My goal is connected with pages with price information, from which items may be
bought.
These are html pages with no server side facilities whatsoever assumed.
[Any users that have asp for example would be advised by what you have written
below]

As the pages may be medium sized say 25k 50K? and the prices will be valid for
a while, I would like to
a) Set an expiry date in a META tag (URL for format advice on that??)
b) Have a script which after comparing system date to document.lastModfied
would force a reload from the server if the gap between the two dates exceeded
a given number of days - which would be set to coincide with the expiry date in
a META tag - what we call "belt and braces" methods to achieve the desired end
- display of valid in-date prices to customers.

I would appreciate comment upon the matter of forcing a reload in these
circumstances.

TIA

Rodney


> > I have been thinking of a script that
> > might compare system date to document.lastModfied for example.
>
> May I ask what your goal is? Are you dealing with dynamic code from a
> database? If so, you should use headers. If not, then leave caching to the
> browser since most browsers handle static pages well.
>

Josiah Gordon wrote:

> Rodney,
>
> > I would like to know if this server side
> > application to the header has a better
> > performance than adding
> > <meta http-equiv="Pragma" content="no-cache">
> > <meta http-equiv="Cache-Control" content="no-cache">
> > to the HEAD ?
>
> Absolutely. The meta tags are not supported by many devices and for good
> reason. Netscape 4.5 has a bug with the no-cache meta tag and all versions
> of IE are finicky (at best) with the cache-control meta tags.
>
> The reason MS has never cared is because only HTTP headers should *really*
> have the right to control cache. This is because of proxy servers: Imagine
> AOL - they cache every web page requested through their software to save
> bandwidth. Now imagine, that instead of reading the >1K headers of the
> HTTP/1.1 responses, they had to open and parse every HTML page that passed
> through their proxies. That's a lot of extra (and unneeded) overhead when
> headers are efficient, standardized, and well documented.
>
> If you want to disable caching, headers are the only single reliable way to
> do it.
>
>
>
> --Josiah Gordon

--
Shop at ssistant Add-ons and Developer Workshops
http://www.aflyingstart.net/addons/

Enquiries regarding Shop at ssistant Classic training :
Call 01256 880770

Rodney Myers
Based in Oxford, England
Technical Director, Shop at ssistant eCommerce Solutions






More information about the Javascript mailing list