HTML and CSS Reference
Path. The path is used to specify where the cookie is valid for a particular server. Set-
ting a path for the cookie allows other pages from the same domain to share a cookie.
Secure. If a cookie is secure, it must be sent over a secure communication channel
In the following examples, we will create a cookie, view the cookie, and then destroy it.
It is important to note when you are setting cookies that they are stored in the browser's
memory and not written to the hard drive until you exit the browser.
cookie data. Cookies are made by assigning attributes to the cookie property. When you
start your browser, if there are cookies, they pertain to the current document. The doc-
ument.cookie property contains a string of name=value pairs representing the names of
all the cookies and their corresponding values, such as a session ID number or a user ID.
All the other attributes set for the cookie, such as expiration date, path, and secure, are
you will see all the cookies set for this page.
Figure 16.5 Using alert(document.cookie);