Wed 09 Mar 2016


HTML provides some mechanisms for persisting data. Most of them are bad.


/*global localStorage, sessionStorage*/
// Persists
localStorage.x = "blah";
// Cleared when browser closes
sessionStorage.y = "hello";

Synchronous only.

Strings only.

About 5MB per origin.

Should use it instead of cookies, because it doesn't get sent to the server (so, it's faster).

Probably not good enough for our purposes?


It's an indexed key-value store.

  • Async
  • Transactional
  • Quick search

It's got some versioning, so that if you change the schema you can specify a function to handle the migration.

Maybe a little too new?


Too early.

It's a sandboxed file system.


Not supported in Firefox, IE. Deprecated.


There's persist-js. Sounds a bit dodgy. Not really maintained any more.

Not sure what else.


There is a quota API. It's not that widely used yet.

I need to know how much storage I'll have.


Most of these have async APIs, which you can use.


Poor support at the moment. Lets multiple web pages talk to the same worker. Interesting.

Offline Apps

Application Caching

I'm not really sure about this. You can specify some manifest file which says which things can be cached, and which must come from the network.

It's like normal browser caching, but still works if you're completely offline.