You are previewing Instant HTML5 Local Storage How-to.
O'Reilly logo
Instant HTML5 Local Storage How-to

Book Description

Over 15 recipes to take advantage of the HTML5 Local Storage standard

  • Learn something new in an Instant! A short, fast, focused guide delivering immediate results.

  • Learn the basics of how to use the LocalStorage standard, and view the results in your browser

  • Learn how to detect when you can use LocalStorage, or when to fall back to using cookies, as well as how to convert an existing site to use LocalStorage

  • Using LocalStorage to store images, arrays, and objects for use in your site

In Detail

The use of cookies to store information in a browser has been around for over a decade; its simplicity has led to its use in a variety of applications, such as online shopping baskets, but which has also lead to some inherent drawbacks in terms of security and use. HTML5 LocalStorage brings much needed additional functionality to your browser, allowing you to store more useful information that you can later reference in your websites.

"Instant HTML5 Local Storage How-to" is a practical, hands-on guide that provides you with a number of clear step-by-step exercises, which will help you take advantage of the power of the LocalStorage standard, and give you a good grounding in incorporating it into current or future website projects.

This book looks at how you can incorporate the HTML5 LocalStorage standard into your websites, using the power of modern browsers to store useful information that can be referenced at any time without recourse to the server.

You will also learn how to test for browser capability, and when the browser platform being used requires that you fall back to using cookies. We will also take a look at how you can store more relevant content, such as images or content from arrays, even though the normal standard requires content to be stored in string format. You will also learn how you can make content available offline using application caching, as well as how to incorporate LocalStorage into a plugin using jQuery that you can then incorporate into your sites in the future.

We will also look at some real-life examples, where "Instant HTML5 Local Storage How-to" will take you through how you could incorporate LocalStorage into your sites; we’ll take a look at code you can simply add to a site, or use as a development platform for your own future projects.

Table of Contents

  1. Instant HTML5 Local Storage How-to
    1. Instant HTML5 Local Storage How-to
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
    7. 1. Instant HTML5 Local Storage How-to
      1. Basic use of Local Storage (Must know)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      2. Viewing Local Storage content in a browser (Must know)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
      3. Basic demo for Session Storage (Must know)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Comparing Local Storage and Session Storage (Should know)
        1. How to do it...
        2. How it works...
        3. There's more...
      5. Using web storage instead of cookies (Must know)
        1. How to do it...
        2. How it works...
        3. There's more...
      6. Basic detection for storage support (Must know)
        1. Getting ready
        2. How to do it...
        3. How it works...
      7. Improving detection using Modernizr (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Providing fallback support (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
      9. Is the user online or offline? (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      10. Using a manifest for caching (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
      11. Providing support for the mobile platform (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
      12. Building a simple plugin using jQuery (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      13. Adding objects, arrays, and TTL support to storage (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
      14. Storing images within Local Storage (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      15. Adjusting the Local Storage space for browsers (Must know)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      16. Building a stickies option for using in a browser (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
      17. Building a simple to-do list (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      18. Using Local Storage in a form (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
      19. Using Local Storage in a CMS (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      20. Using Local Storage to hide sign-up forms (Become an expert)
        1. How to do it...
        2. How it works...
        3. There's more...