Java Reference
In-Depth Information
4.
Click Close to get back to the browser, and load FreshBakedCookie.htm.
5.
Repeat the process you followed previously to get to the Cookie Manager, and you should fi nd
that the UserName cookie has been added to the box. Because it's loaded from a fi le on your PC
and not the Internet, the cookie has a blank web address. The expanded cookie details are shown
in Figure 11-10.
Figure 11-10
Note that buttons are provided at the bottom of the Cookie Manager to remove the cookie selected or all
of the cookies that are stored.
Now that you've seen how to view cookies manually, let's look at how you create them and read them
using code. You'll start by looking at each of the parts making up a cookie string.
The Cookie String
When you are creating a cookie there are six parts you can set: name, value, expires, path, domain,
and secure, although the latter four of these are optional. You'll now look at each of these in turn.
name and value
The fi rst part of the cookie string consists of the name and value of the cookie. The name is used so that
you can reference the cookie later, and the value is the information part of the cookie.
This name/value part of the cookie string is compulsory; it sort of defeats the point of the cookie if you
don't store a name or value, because storing information is what cookies are all about. You should make
sure that this part comes fi rst in the cookie string.
Search WWH ::




Custom Search