|
JavaScript is one of those languages that comes in handy at some
of the oddest moments. For example, I am working on a script that
plays a voice over upon a visitor's first time to a website. The
voice over introduces the website and the persona behind it. Of
course, I don't want that script to play every time that same visitor
comes back to the website. What's even worse is the voice over playing
everytime that visitor goes back to the homepage within
that same visit.
One potential solution would be to dump the entire thing over to
the web server. This is known as "server-side" processing. Most
references explain these items in the terms of "server-side
validation". That is something entirely different. Please don't
get confused between the two.
Server-side validation is something that occurs in conjuction to
a webform or to an application that is tracking something. For example,
a website runs a product promotion special and sends a coupon via
email to their internal customers. When a customer goes in to collect
on a coupon, the server would validate that this person is indeed
one of their internal customers with the "privilage" of
collecting on this special.
In the case of my voice over I thought, well it's a creative media
and it plays in the asthetic to the overall site's "feel"
and personality. In other words, this voice over does not do any
processing with a database or a webform. It's nature
is more client-side than server-side.
In this case I wrote a simple cookie script. The javascript checks
for the existance of a cookie. If the cookie exists then the sound
is not played. If the cookie doesn't exist, then the sound plays
and the cookie is written. Of course, not everyone accepts cookies,
but regardless, for our clients that do they don't have to hear
this sound over and over again during their website visit.
In this case the cookie works with a straight-forward HTML page.
I also looked at getting it work correct with ASP. This is a whole
other story and is appropiate with part two, which will get into
server-side processing. Okay, on with the Javascript
tips n' tricks.
|