O'Reilly logo

Sams Teach Yourself HTML5 in 10 Minutes by Steven Holzner

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

Lesson 9. Web Storage

One of the things that HTML authors have missed is some way of storing data between page accesses. When the page gets refreshed, all JavaScript variables get reset to their original values, for example. How can you store data that’s still there when the user comes back to your page?

This is often why people start working with server-side code—to preserve data between page accesses. However, now, in HTML5, there’s a new way. So, for example, if you’re keeping track of a user’s purchases, you can store that information so that it’ll be available when they come back to the page.

Using plain JavaScript and HTML5, you can now store data so that it’s there even after the current page is reloaded. You can store data in either ...

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