O'Reilly logo

Instant HTML5 Local Storage How-to by Alex Libby

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

Using web storage instead of cookies (Must know)

In this recipe, we're going to take a look at how you can approximate the effect of Session Storage, if you are forced use really old browsers. We'll first look at a simplified example of how you can use Local Storage and compare that to the closest available effect, if you had to use just cookies.

Note

Please note this recipe is intended to only serve as an example. It is not one that I would recommend using unless you need to maintain support for very old browsers, which is very unlikely. Most recent browsers will support the first part of this demo without too much of an issue.

How to do it...

To use web storage instead of cookies, perform the following steps:

  1. Crack open a new HTML document and add ...

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