Java Reference
In-Depth Information
recommendations. This sounds a little
complex, and certainly the fine details
of the policy can be. Because of this
complexity, very few implementations of
P3P exist. But many groups are working
to make it easier for people to use.
WeB storage
Cookies are a useful tool that web
developers can take advantage of to
store data on the user's computer.
But cookies are a tool designed for a
different time, and thus, a different
Web. Although they served a specific
purpose (and did so reasonably well),
their limitations are not ideal for
modern JavaScript development:
The first issue is the application
programming interface (API). To
write and read cookies, you use
the document.cookie property.
Writing a cookie is relatively
straightforward, but reading
a specific cookie requires a lot
of code. You wrote two helper
functions to make writing and reading cookies easier, but ideally, you shouldn't have to.
figure 13-19
Cookies are not a browser feature, but a feature of HTTP. As such, the browser sends them
to the server on every request. This is useful for applications that live on the server, but it's
unnecessary for JavaScript that runs in the browser.
The browser limits the amount of cookies it stores and the size they can be. As mentioned
earlier, this can be anywhere from 20 to 50 cookies for each domain, and each cookie cannot
exceed 4KB.
Cookies are shared between both the browser and the server. If your server application needs
30 cookies (120KB) to function, that at best leaves you with 20 cookies (80KB). You're out
of luck if you need more.
They can expire. Although you can control this by setting and maintaining an expiration
date, it's simpler to not have one.
HTML5 introduced a new feature called web storage , and it solves each of cookies' aforementioned
problems. Since its introduction, web storage has been moved out of the HTML5 specification and
into its own (which is named Web Storage). It consists of two components: session storage and local
storage . As you may have guessed, session storage is temporary storage that is cleared when the user
 
Search WWH ::




Custom Search