Delete HTML5 Web SQL Databases

Mar3111Mar 31, 11


I've been spending a lot of time in Chrome's new "Clear Browsing Data" UI, and I wanted to make sure other people don't fall into the same trap.

While window.openDatabase and friends are fast and efficient for client-side storage, the API is underwhelming.  For all the complexity of SQL, something like deleting a created database is still not possible.  That sucks, and I would certainly consider it an oversight in the API design, not a feature as SQLite fans tend to portray it.

The only way to really delete a Web SQL Database (in Chrome, at least), is to clear all client-side storage mechanisms through the Clear Browsing Data interface (Command+Shift+Delete).  

The main problem with this limitation is that it's possible (and very easy) to screw up Web SQL DBs.  For example, calling openDatabase numerous times on a single page results in this lovely mess in Web Inspector:

How useful is that?  Oh and if you were wondering, all those identically named databases also contain tables named "undefined" with no results that fail to open.

Not that I fault Chrome - it's obviously a very early stage in the development of this API, and they are taking a risk in order to push the web forward faster than the W3C can be bothered to make simple decisions (are they making any these days?).

I'm putting out a call for solutions here - can anyone come up with a way to actually delete (drop?) a WebkitSQLite database in Chrome?

About Jason Miller:

I am a JavaScript developer from Waterloo, Ontario, Canada. When I am not typing green code onto a black screen, you might find me at the nearest coffee pub checking out the brew. I run a internet firm called developIT and maintain blogs and web apps when I can.
Comments
Leave a Comment

Post Comment