Java Reference
In-Depth Information
As you can see, a cookie is just a plain old text file. Each website, or domain name , has its own text
file where all the cookies for that website are stored. In this case, there's just one cookie currently
stored for google.com. Domains like amazon.com will almost certainly have many cookies set.
In Figure 13-6, you can see the cookie's details. Here, the name of the cookie is PREF ; its value is a
series of characters, which although indecipherable to you make sense to the Google website. It was
set by the domain google.com, and it relates to the root directory / . The contents probably look like
a mess of characters, but don't worry. When you learn how to program cookies, you'll see that you
don't need to worry about setting the details in this format.
After you have finished, close the cookie and click OK on the dialog boxes to return to the browser.
Now let's load the freshbakedcookie.html page into your IE browser. This will set a cookie. Let's
see how it has changed things:
1.
Return to the Internet Options dialog box (by choosing Tools Internet Options).
2.
Click the Settings button.
3.
Click View Files. Your computer now shows something like the information in Figure 13-7.
figure 13-7
If you loaded the HTML file from your computer, you created a cookie from a web page stored on
the local hard drive rather than a server. Thus, its domain name has been set to the name of the
directory in which the web page is stored. Obviously, this is a little artificial. In reality, people will
be loading your web pages from your website on the Internet and not off your local hard drive. The
Internet address is based on the directory the freshbakedcookie.html file was in. You can also see
that it expires on December 31, 2020, as you specified when you created the cookie. Double‐click
the cookie to view its contents, which look like those in Figure 13-8.
Search WWH ::




Custom Search