O'Reilly logo

jQuery Mobile Cookbook by Chetan K Jain

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 local and session storage

Cookies was the mechanism used to store client-side information earlier. But a cookie can only store up to 4 KB of data, which is sent to the server with every single request. Web Storage is the client-side storage standard introduced with HTML5. It has two types: Local Storage and Session Storage . Data stored in Session Storage is available till the user's session is active, and is lost once the session ends. Local Storage data is persisted across sessions. This recipe shows you how to use Local Storage and Session Storage.

Getting ready

Copy the full code of this recipe from the code/11/storage folder. You can launch this code using the URL: http://localhost:8080/11/storage/main.html.

How to do it...

The steps ...

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