Re: Cookie Question

by "Greg Rundlett" <greg(at)freephile.com>

 Date:  Tue, 30 May 2000 20:00:14 -0400
 To:  "Ron Upton" <rwupton(at)kellnet.com>,
<hwg-languages(at)hwg.org>
 References:  computer
  todo: View Thread, Original
> I used JavaScript to place a cookie on a clients home page to remember the
> visitors name and how many times the visitor has visited. Is there a way
to
> limit the cookie to the initial visit and not every time the visitor goes
to
> the home page. I hope I asked this right :-).

Your JavaScript function could set any cookie value you want it to.  In this
case, all you need do add some logic.

A psuedo-code breakdown of your solution would be something like:
    check to see if cookie exists,
        if so do nothing;
        if not, set cookie

A JavaScript script that accomplishes this can be viewed in action at my
homepage http://www.freephile.com.  You can download the source at
http://www.freephile.com/js/functionality.js

It is commented somewhat, but for a better explanation of how this works,
see if you can get your hands on a copy of Nick Heinle's book Designing with
JavaScript

I've discovered in answering your question that my script is now broken (I
think due to a change in IE's date object for the Y2K--because I'm pretty
sure it worked before on both platforms)  It currently only works for NN.  I
know it's the delete cookie function that is not working on my site, so you
can still use the other functions.

Greg Rundlett
Sr Web Developer at a major dotCom
Sr. Geek  www.freephile.com & www.philosofree.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA