Java Reference
In-Depth Information
figure 13-20
You can only view the web storage of the domain of the page currently loaded in a given tab; you
cannot view one domain's web storage from another domain.
summarY
In this chapter, you looked at how you can store information on the user's computer and use this
information to personalize the website. In particular, you 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 you can set. These are the name, the 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, you found that retrieving its value actually gets
all the cookies for that domain and path, and that you 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, you are limited to 50 cookies per domain in IE7+ and Firefox and a maximum of
4,096 characters per cookie name/value pair.
Web storage is a new key/value pair data store that replaces the need for cookies for
JavaScript developers. Though it was originally introduced with HTML5, it is now its own
specification.
 
Search WWH ::




Custom Search