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

Comparing Local Storage and Session Storage (Should know)

At the beginning of this book, we took a look at how you can use Local Storage to store persistent information on a client computer, which remains there even when the browser is closed. That's great, but isn't it a little overkill for instances such as shopping carts? You'd be right – we don't need to store information about purchases forever; indeed, information should only be stored for the duration of the current session. In this recipe, we're going to take another look at Session Storage, to see how it stacks up against LocalStorage.

How to do it...

In the following steps, we will take a look at how it works and stacks up against Local Storage:

  1. Let's begin by creating a new HTML document. ...

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