HTML and CSS Reference
version transaction. Remember earlier on in this section, when I
showed you how to create object stores—the setVersion success
handler is the only time you can both add and remove stores.
Finally, there's deleteDatabase . As handy as this would be for
debugging, unfortunately it doesn't appear to be implemented
in any browsers right now. I expect this will change as the speci-
fication matures and isn't vendor-prefixed, but for the time being
it does make debugging difficult because it's hard to get back to
the reset position.
Deleting an IndexedDB database in Chrome
There are probably ways of doing this in each browser, but I've discovered a way of removing the
database, if you're happy poking around in Chrome.
Navigate to ~/Library/Application Support/Google/Chrome/Default/IndexedDB on a Mac and
C:\Users\<you>\AppData\Local\Google\Chrome\User Data\Default\IndexedDB\ on Windows 7
(other system paths can be located at http://goo.gl/v702q ) .
Once you're in the IndexedDB directory, you can see databases listed by their domain. If you want to
clear that database, make sure Chrome is closed, and just delete that file.
Do so at your own risk though—don't come running to me when your browser blows up all over your
machine. That said, it's worked just fine for me so far!
Debugging is hard. At the time of writing there are two key
components missing from IndexedDB:
• There are no debugging tools. Web SQL Database and
Web Storage both have visual tools in the browser web
inspectors (like ChromeDevTools or Opera Dragonfly). There
are currently none for IndexedDB, making it quite difficult to
debug. It's not impossible—just tricky!
• There's no way to delete a database. As only Firefox and
Chrome have IndexedDB at this time, and both still have
vendor prefixes, I suspect this is only something that needs
to be added. Since a necessary step during development is
to reset the current state of the application, not being able
to delete the database is fairly limiting. You can get around
this by manually deleting all the object stores and then
resetting the version, but it's really not the same!