2

Is there a way for an application to get a list of databases assigned to it's own origin/domain?

I have an app that creates and uses multiple indexeddb databases. It keeps track of each of them, but I would like to be able to delete all the databases and recreate them on demand so a user can get to a 'clean slate', even if the list the app maintains is corrupted some how.

ed4becky
  • 1,488
  • 1
  • 17
  • 54
  • 1
    I don't think the situation has changed since [this question](http://stackoverflow.com/questions/15234363/indexeddb-view-all-databases-and-object-stores). – dumbmatter Jan 20 '14 at 17:30
  • Thanks Jeremy. I am webkit only so that solution was great. – ed4becky Jan 20 '14 at 19:13
  • Ther answer here worked for me [http://stackoverflow.com/questions/15234363/indexeddb-view-all-databases-and-object-stores][1] [1]: http://stackoverflow.com/questions/15234363/indexeddb-view-all-databases-and-object-stores – ed4becky Feb 10 '14 at 16:50

1 Answers1

1

Databases have two main characteristics: a name and version.

You can get away without knowing the latter, since if you open up a database without a version you automatically get a reference to the most recent version; however, with the exception of the non-standard (but insanely useful) webkitGetDatabaseNames in Chrome, you cannot enumerate database names for a given host.

A common pattern I see is to store database names in localStorage, which has similar "temporary data" cache purge behavior to IDB.

buley
  • 28,032
  • 17
  • 85
  • 106