Page 5
Toss Them a Cookie
The bold and not-so busy might consider harnessing the power of cookies as
a way to serve up custom content. By requiring different passwords or
employing different entry points, you can set cookies that will control
navigation bar options, visible links, and even the actual content of the
page. I can't tell you how often I've dreamed of implementing a scheme with
a just-for-grandma cookie that would render my Web pages free of all
foul language. But even I have better things to do with my
time.
It's worth taking a good look at the cookie portion of Thau's Advanced
JavaScript Tutorial to master reading, writing, and employing
cookies. Cookies provide a powerful, scalable way to govern your site. You
already know that you can use cookies to make sure that your mother's
version of your Web site loads with the picture of your new haircut, while
your friend's gets the picture of your new piercing. But you can also use
them to keep links workable and prevent entire pages from loading for those
determined enough to enter the secret URLs by hand.
Instead of using
password information to direct people in fixed directions like a low-rent
traffic cop, setting cookies based on password responses allows you to read
them from any page on your site. Ultimately, this gives you the power to
micromanage in a way that would be impossible otherwise.On the other hand,
subdividing a Web site by using passwords without cookies forces repeat
visitors to enter passwords every time they stop by. Even worse, if you
have multiple regions hiding behind passwords, moving from one section to
another will force users to enter multiple passwords in a single
session. Needless to say, navigating your cookieless site will soon feel
like trying to board an airplane at SFO during the holidays - in the
fog. Using cookies allows you to set access levels once and for all, and
that greatly increases what we in the biz like to refer to as user friendliness.