As Web applications become more powerful and useful, the need has arisen for them to be able to store structured information in the user’s browser. This is the problem that the W3C’s Web Storage specification has set out to solve.
At the moment, the specification aims to expose a particular implementation of SQL to web pages. Vladimir Vukićević has written about flaws in this approach. Among them are:
- While a lot of server-side developers already know SQL, it’s actually quite low-level and not very easy to use. This goes against the grain of the Web as a platform, which is something that should be as easy to develop for as possible.
- There’s no useful core SQL standard, and as a result the specification effectively says “do what SQLite does”. Because “what SQLite does” isn’t well-defined and can change in future versions of SQLite, it effectively means tying all browsers to a particular implementation, and any security vulnerabilities that the implementation may have.
It seems that a different approach is required and we’re highly interested in exploring alternative proposals to SQLite for Web Storage.
I’ve recently undertaken an experimental re-implementation of CouchDB in the browser to explore the possibilities of using a simpler standard that delegates many of its semantics to the JavaScript language and is also easily parallelizable to take advantage of multiple processor cores. For instance, putting posts into a blog database might look something like this:
blogDb.put( [{author: 'Myk', title: 'Burritos', content: 'Burritos are yum.'}, {author: 'Thunder', title: 'Bacon', content: 'I like bacon.'}, {author: 'Thunder', title: 'Beer', content: 'Beer is good too.'}], function onDone() { /* Do stuff... */ } );
Take a look at the BrowserCouch Tutorial for more information on how this kind of Web Storage API would look and work—it also lets you play around with the MapReduce algorithm interactively, so you can really get a feel for it.
Please do let us know what you think, or if you have other ideas on how best to approach Web Storage.
— Atul Varma, on behalf of the Mozilla Labs team
Ashok
wrote on
:
Matthew
wrote on
:
Kas Thomas
wrote on
:
redapple
wrote on
:
Tom Bonner
wrote on
:
legoxx
wrote on
:
Mark Finkle
wrote on
:
Simon
wrote on
:
Gil
wrote on
:
Jason Huggins
wrote on
: