This JavaScript example counts the number of visits to this site (page). It uses that information to send the user directly to the correct page on the site (via a parameter). A test-only variable should be set to false to turn off the test mode.
This JavaScript uses cookies to get input from the user 1 time per users web session. It uses a non-persistent cookie to prompt the user for a word - it then stores it for the rest of that web browser's life. It will use the value input and stored in the cookie to put that word onto the page that it is loading.
This example stores 3 variables into a cookie, and then retrieves them. It puts the values into a form text box where the user can change the values. A window can be made to open up where that window has the cookie values written on it.
The author notes" I was using IE version 5.5 to find the maximum size you can have a cookie be. This seems to be on the side of working - add 1 more to the size and it will not work as the cookie becomes too big. It should be easy enough to take this script and use it for yourself to test your web browser (future releases)."
Let a JavaScript cookie remember your favorite background color. On the first visit, it prompts for your favorite background color and change it to your choice. On future visits, it automatically displays that background color for you.
You can use a basic cookie script to keep visitors (that don't have the cookie on their system) from viewing certain parts of your site (kind of.... There are always ways around it). The cookie is placed when the password provided is correct. Then, when they are forwarded to the password protected page, the cookie allows them to stay. Those without the cookie are sent back.