One of the more powerful features in HTML5 is the ability to store data locally via the browser. Of course, browsers have had this functionality for a long time via cookies, but the HTML5 spec extends this concept even further, solving some additional web site use cases, and opening the door for the rapidly emerging mobile world.
SpecificationsThere are two mechanisms defined in the web storage spec: sessionstorage and localstorage. Sessionstorage allows for session-specific data to be stored, which can be helpful for maintaining state information that you may not want to extend into another visit. This even applies to sessions from the same visitor, within different tabs of the same browser. This is a better solution than cookies for scenarios where you want to keep transactions separate from one another. The spec notes this use case:
"For example, a user could be buying plane tickets in two different windows, using the same site. If the site used cookies to keep track of which ticket the user was buying, then as the user clicked from page to page in both windows, the ticket currently being purchased would "leak" from one window to the other, potentially causing the user to buy two tickets for the same flight without really noticing."
The localstorage mechanism, on the other hand, persists across sessions and visits.
How much storage?The spec currently suggests a limit of 5MB per origin (domain) for this new storage. This may change as the spec continues to be revised. At 5MB, it's certainly much larger than the limit on cookies today.
PrivacyThere's a decent sized section of the spec that speaks to "user tracking". There's clearly a strong concern about how this storage mechanism could be used to build user profiles and potentially track personal information. It looks like the working group developing this spec is taking privacy concerns very seriously, and are building in good safeguards.
Some thoughtsThis storage would have been a great mechanism to have many years ago, but I'm not sure we were really ready for it. I think we've learned a lot over the years about privacy, and protecting personally identifiable information, and the time is much better now for such power.
The possibilities with this storage mechanism are fantastic. Google has already been making use of this functionality to help improve its apps. Apple has been a strong supporter of advancing the HTML5 spec in general.
But the rise of mobile computing has really made this mechanism important. Some very smart folks are already figuring out how to leverage localstorage to build apps that behave like a native app (eg, an iPhone or Android app), but are actually running in a browser. Check out
Nextstop on your mobile device to see an example of what I mean. By pre-fetching and storing content, the experience becomes extremely rich when moving from view to view. It's quite amazing to experience it.
The Analytics connectionAnalytics providers like
Webtrends can obviously make use of the localstorage mechanism in creative ways. But the real thought-leadership will come with providing new analysis of usage of the storage functionality so website owners can better optimize their sites. More good opportunities for analytics providers and practitioners!