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

Improving detection using Modernizr (Should know)

In the previous recipe, we used some basic JavaScript to perform a rudimentary check to see if the Local Storage or Session Storage support is enabled. Since this works, it is not infallible. As part of this recipe, we will use Modernizr to perform a check that is more reliable, and which works better with the advent of HTML5 functionality.

Getting ready

For this recipe, we will need some icons—one cross and one checkmark—in addition to a normal text editor of your choice. A good source is the silk icons available from FAMFAMFAM at http://www.famfamfam.com/lab/icons/silk/. For the purposes of this recipe, I will assume you've downloaded and are using the icons from this library.

How to do it...

For ...

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