CMPS 491 Advanced Web Publishing Using Cookies


For security reasons, JavaScript is limited in the way that it can save information to the client computer's hard disk.  Cookies, however, provide a way you could write to the hard disk.  When you write to a cookie file, a special text file, you are creating a cookie.  It is a device that some webmasters may use to remember your name, your last visit, and other information.

A cookie is a unique piece of information given by the Web server and saved on the visitor's hard disk.  Through a browser, a cookie can be stored, retrieved, and deleted.  A cookie file can store a maximum of 300 cookies, with a maximum of 4 KB per cookie.  Cookies are accessible through the document.cookie object.