So far, we've looked at using Local Storage in our websites. This assumes that they have been built from scratch over a period of time. However, we cannot afford to ignore CMS systems, particularly popular ones such as WordPress. The great thing is that a plugin for WordPress has been developed to take advantage of Local Storage. We're going to take a look at this plugin as part of this recipe.
For this task, you will need access to a working installation of WordPress, either remotely or using a local web server such as WAMP Server. I will assume you are using an instance of the latter for the purposes of this recipe (currently at version 3.5 at the time of writing this book). You will also need a copy of the open source Local Storage Backup plugin, which is at version 0.92 (at the time of writing this book), and is available to download from http://wordpress.org/extend/plugins/local-storage-back-up/.
Perform the following steps, for using Local Storage in a CMS:
This is one of those plugins for WordPress that does a simple job well. It sets WordPress to divert any requests for publishing posts to LocalStorage
, if it determines that you are working offline as a result of a dropped connection. As soon as your Internet access has resumed, it will recognize that there are posts that need to be published, and prompt you to complete this process.
It should be noted that this plugin isn't designed to handle comments in a similar fashion. If you want to include this facility, take a look at another plugin called WP Local Storage, which is available at http://wordpress.org/extend/plugins/wp-local-storage/.
We're almost at the end of our journey through Local Storage. Before we finish, there is one more area we are going to look at, which relates to forms. Ask yourselves this question, "How many times have you visited a site as a registered user, only to find that it still thinks you are a new user?" Sounds familiar? We'll see how to avoid this, as part of the next recipe.