How can I remove a whole IndexedDB database from JavaScript?

As far as I can tell, one should use indexedDB.deleteDatabase:

var req = indexedDB.deleteDatabase(databaseName);
req.onsuccess = function () {
    console.log("Deleted database successfully");
};
req.onerror = function () {
    console.log("Couldn't delete database");
};
req.onblocked = function () {
    console.log("Couldn't delete database due to the operation being blocked");
};

I can confirm that it works with PhantomJS 1.9.0 and Chrome 26.0.1410.43.

Leave a Comment

tech