O'Reilly logo

Sams Teach Yourself HTML5 Mobile Application Development in 24 Hours by Jennifer Kyrnin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hour 21. Web Storage in HTML5

What You’ll Learn in This Hour:

• How to use local storage

• How to detect local storage support

• When to use local storage versus cookies

• How to add local databases using Web SQL and Indexed DB

• How to build an application that uses local storage

Before HTML5 the only way you could store information was either by adding it to the DOM (Document Object Model) or using cookies. But both have drawbacks.

Storing data in the HTML is fairly easy to do but it requires JavaScript, and it can only store data as long as the browser is open and on the application. As soon as the user’s session ends, that data is lost. Plus, data that is stored in the HTML is visible to anyone.

Cookies are limited to around 4KB of data, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required