O'Reilly logo

HTML5 Multimedia Development Cookbook by Lee Jordan, Dale Cruse

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

Setting and getting a local storage variable

Although session storage is temporary, and lasts only as long as a browser session is active. Local storage persists even after a browser is closed. In this recipe, we will create a story-writing application using the HTML5 contenteditable attribute and local storage.

Getting ready

You should be using a recently updated browser. This recipe works best in Google Chrome and Safari but also functions fine in Firefox.

How to do it...

First create a basic HTML5 page, and then add a script tag between the opening and closing head tags. The script should link to the 1.5.2 minimized jQuery library at http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js. Your code should now look similar to the following ...

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