andyuk.net

A blog about technology and web development

Developing offline web apps with HTML5

Comments

Fist with HTML5 on fingers, an image from Flickr

There are currently 3 separate areas of the HTML5 specification that will help you build an offline web application; web storage, offline caching and web database.

These areas are in different stages of development. Only web storage has been implemented by the latest versions of IE, Firefox, Safari and Chrome. The following pages are good places to find out the very latest status:

Web storage

This is basically key/value storage or, as Remy Sharp put it, “basically cookies on steroids“. It will help web developers store more data on the client side, but since it does not provide a means to loop through records it will have limited uses.

To find out more about implementing this,  a great summary web storage and offline caching.For all of the details check out the Web Storage specification.

Offline caching

The specification is pretty simple. Define a manifest file with a list of all of the files that should be cached for offline usage. Then link to the manifest file by using the following HTML.

<html manifest="myapp.manifest">

You can also use JavaScript to control what stays in the cache. Check out the 24ways.org article for info about offline caching.

Web database

There are two draft W3 specifications that are in the running to make it into the HTML5 spec; Web SQL Database and Indexed Database API.

Web SQL Database

Google have already developed a GWT mobile webkit that has an API based on the Web SQL database spec.

This spec uses the SQLlite dialect of SQL. Since SQLlite’s SQL doesn’t have its own spec, work needs to be done to establish a full specification.

Index Database API

This seems to be Oracle’s choice. Since this API doesn’t use SQL, NoSQL databases such as CouchDB will prefer this specification.

The specifications seem very comprehensive, yet the sample code looks very simple.

Summary

The web database specifications are still very much work in progress at the W3C. It’s going to be a while before an agreement is made on standards and browsers do their implementations.

I really hope the Index database API (or NoSQL) version wins over the SQL spec. I don’t want to be tied down to using SQL which means not be able to take advantage of document-orientated databases such as CouchDB, MongoDB and Redis.

Written by andy

January 11th, 2010 at 8:38 pm

Posted in Uncategorized

Tagged with ,

blog comments powered by Disqus