206 Chapter 8—Web Storage and Offline Web Applications
without a network connection. Both approaches are very straightforward and
simple, yet robust.
8.1 Storage
A structured client-side storage that exceeds the meager cookie limit has long
been requested as an extension of the World Wide Web. Adobe integrated a func-
tion for storing data locally in the Flash Player with version 6, calling this tech-
nique Local Shared Object (LSO). The default setting of LSOs is 100KB, but it
can swell to 10MB if required (after confirmation by the user). The problem with
LSOs, often also referred to as Flash cookies, is that they can only be used with
Flash and therefore fall outside the browser’s security model. Even if a user de-
letes all his browser cookies, a website can still track the user via Flash cookies.
According to Wikipedia, more than half of the top websites on the Internet use
Flash cookies to analyze user behavior.
The WHATWG has recorded its deliberations on the subject in its Web Storage
document. Although Web Storage was removed from the core of the HTML5
specification, it is still most definitely related to it. Currently, the W3C specifica-
tion is still at the Editor’s Draft stage, but because the implementation has been
stable in all common browsers for some time (see section 8.3, Browser Support),
significant future changes are unlikely.
The current version of the W3C’s Web Storage specification can be found at
http://dev.w3.org/html5/webstorage.
The WHATWG version is available at http://www.whatwg.org/specs/web-apps/
current-work/complete/webstorage.html.
8.1.1 The “Storage” Interface
The “Storage” interface defines the common attributes and access methods of
the persistent storage. Regardless of whether it is a sessionStorage or a localStor-
age object, both contain the methods or attributes presented in Table 8.1.