HTML 5 local storage, quickly

Inspired by my playing with Chrome Web Apps, I sat down and read up on two of the ways HTML 5 allows Javascript to use local storage.

Offline Web Applications let you build webapps that work even when the user has no network connection. The key thing is you create a “cache manifest” file which contains a list of the files that should be cached locally. If the user is offline (or if the site is down?) then the browser will use the cached version. There’s complicated extra stuff for fallbacks and wildcards that allow for webapps to opportunistically cache just the stuff the user saw for some other reason. And there’s DOM events to let the webapp know what’s going on with caching and network status.

Local Storage is a variety of technologies for a webapp to read and write data on the local hard drive. The main new one is the localStorage object, a persistent Array. Basically a key:value store with String being the only datatype. Apps get 5 megabytes of local store. There’s also some work being done on SQL and object databases, but nothing finished yet. Miraculously, local storage seems to work in every browser, even IE 8 and above.