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

Josiah Gordon jgordon at directfile.com
Tue Jun 26 11:43:30 CDT 2001


Rodney,

> I have over 1000 sites using my shopping
> scripts and I want to give best advice
> to users with pricing information on their
> pages that may become out of date
> while in cache.

I just do not think that you have to worry about it. The default caching in
all web browsers takes care of this for you. In IE, for instance, you have
the following options:

Check for newer versions of stored pages:

- Every visit to the page
- Every time you start Internet Explorer
- Automatically (default)
- Never

With three out of four of theses options your user is almost assured to have
the newest prices when they view your pages. The fourth option forces cache
use - that means that every time the user goes to a news site they see the
same news stories from their first visit. My guess is that in reality no one
really uses that setting outside of web kiosks with static content.

Basically, if you are using static HTML pages I hold that any type of
scripted client-side cache control is an attempt to reinvent the wheel (the
caching built into web browsers is already tested and functional).

However, if it would help you rest easier I would recommend something along
your first thought of "a script that might compare system date to
document.lastModfied." Give your users a confirm() box that asks if they
want to reload the page with a decently descriptive explanation of why your
script thinks they should... Just do not rely on it, because it is easily
broken by a number of factors.


--Josiah Gordon



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.262 / Virus Database: 132 - Release Date: 6/12/2001





More information about the Javascript mailing list