In this chapter, we looked at how we can store information on the user's computer and use this to personalize the website. In particular we found the following:
The key to cookies is the document object's cookie property.
Creating a cookie simply involves setting the document.cookie property. Cookies have six different parts we can set. These are the name, value, when it expires, the path it is available on, the domain it's available on, and finally whether it should be sent only over secure connections.
Although setting a new cookie is fairly easy, we found that retrieving its value actually gets all the cookies for that domain and path, and we need to split up the cookie name/value pairs to get a specific cookie using String object methods.
Cookies have a number of limitations. First, the user can set the browser to disable cookies, and second, we are limited to 20 cookies per domain/path and a maximum of 4096 characters per cookie name/value.
Finally, we added the display of a running average for the trivia quiz.
In the next chapter we'll be turning our attention to Dynamic HTML, which allows us to change the contents of a page after it has loaded. We'll be looking at how we can create drop-down menus in a web page for both Netscape Navigator 4.x and Internet Explorer 4.0+ browsers.