O'Reilly logo

iPhone JavaScript Cookbook by Arturo Fernandez Montoro

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

Storing data in session

Thanks to this recipe, you'll know how to use sessionStorage to store properties with values. It's very important to keep in mind the lifecycle of these properties. If the user closes the browser or cleans the HTTP session, our values stored in sessionStorage will be deleted.

The application for this recipe shows you how to store and read one property in sessionStorage. We are going to start by setting and displaying a property called today, which stores the current date using a format based on the value of another property set previously in localStorage. As you've seen in the previous recipe, lang is a property storing the language selected by the user. In this recipe, our application will read this property from localStorage ...

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