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

Is the user online or offline? (Become an expert)

So far, we've looked at how you can use Local Storage (and Session Storage) in your projects, as well as determined if your browser even supports the technology. However, this is all good and well if you're using a normal PC, but what about anyone using a mobile platform, such as iPads or smartphones? We need to know if the unit is working offline, particularly in cases of poor reception. Thankfully, it is really easy to fix this, using our good friend Modernizr.

Getting ready

For this recipe, all you will need (in addition to your normal text editor) is two icons—if you have them to hand. The two we used in the Improving detection using Modernizr (Should know) recipe discussed earlier in this book ...

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