Preface

A question: how many times have you visited a site, where it says "Hello,…" followed by your name? A few hundred…? A thousand…? Lost count…?

I have no doubt that you've probably visited sites, such as Amazon, where this innocuous piece of text is very likely to be displayed using cookies. We've grown accustomed to seeing text such as this everywhere, but it was Netscape's pioneering work back in 1994 that made this possible.

But, I hear you ask, what do cookies have to do with Local Storage? It's simple, cookies are the forerunners for what we now know as Local Storage. In their heyday, cookies worked well, but they have now become old technology. What if I was to say that you could store more than simple text in a browser? How about images? You're probably thinking this isn't possible, but we will see how you can do this, and more, throughout this book.

HTML5 Local Storage was designed to replace cookies, largely as a way to alleviate privacy and security concerns, but also to allow you to do much more while also reducing requests to the server. As a bonus, it also works in most recent browsers, such as IE 8 or recent versions of Firefox. If you still need to support older ones, this isn't a problem, as you will see later in this book!

Interested in learning more? Let's get started…

What this book covers

Throughout this book, we're going to look at a variety of exercises that are designed to help you get accustomed to working with the basics of the new HTML5 Local Storage standard. You're probably wondering what we're going to cover, right? No problem, let me reveal all.

Basic use of Local Storage (Must know) discusses the basics around how you can use HTML5 Local Storage, the security aspects that you need to be aware of, and some of the limitations of what it can and can't do.

Viewing Local Storage content in a browser (Must know) explains how you can view Local Storage content in your browser. It is easy, and you'll see how, using tools such as FireStorage or Web Developer Toolbar in your browser.

Basic demo for Session Storage (Must know) discusses Session Storage, which is perfect for instances when you only need to store values temporarily.

Comparing Local Storage and Session Storage (Should know) provides an example of how you can use Local Storage and Session Storage together.

Using web storage instead of cookies (Must know) illustrates how you can approximate the effect of Session Storage when using old browsers.

Basic detection for storage support (Must know) explains how to check if older browsers will work.

Improving detection using Modernizr (Should know) takes you through how you can improve the checking, using something like Modernizr.

Providing fallback support (Should know) explains how to use fallback support when your browser is not supporting Local Storage.

Is the user online or offline? (Become an expert) discusses how you can check whether you are connected to the Internet or not when using Local Storage.

Using a manifest for caching (Become an expert) illustrates how you can use a manifest file to implement caching and improve response times.

Providing support for the mobile platform (Should know) explains how you can provide support for mobile phones or tablets.

Building a simple plugin using jQuery (Should know) shows you how you can use the power of jQuery to build a basic plugin that you can re-use in your projects.

Adding objects, arrays, and TTL support to storage (Become an expert) explains how you can include support for objects, arrays, and a "time-to-live" facility, which is not available using the standard functionality.

Storing images within Local Storage (Become an expert) explains how you can store images if using jQuery. This will also help in improving response times.

Adjusting the Local Storage space for browsers (Must know) discusses how to cope with the maximum allowed space 5 MB.

Building a stickies option for using in a browser (Become an expert) provides the demos that will show you how to use Local Storage by building a simple stickies applet that you can use in your browser, when viewing websites.

Building a simple to-do list (Become an expert) illustrates how to build a simple to-do list that you can use as the basis for your own projects.

Using Local Storage in a form (Become an expert) explains how to use Local Storage to fill up forms. In this recipe, we move onto a two-part demo, looking at where Local Storage can really make a difference.

Using Local Storage in a CMS (Become an expert) explains how to adapt Local Storage to be used in a CMS, such as WordPress.

Using Local Storage to hide sign-up forms (Become an expert) explains how you can use Local Storage to prevent you from getting irritated in the situations when you use a site that insists on displaying a prompt to sign up, even though you are already a registered user.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset