IndexedDB view all Databases and Object Stores

回眸只為那壹抹淺笑 提交于 2019-11-27 23:38:49

There is currently no way of enumerating the existing databases in the standard. Windows 8 apps use IE, which does not provide the non-standard webkitGetDatabaseNames method. You might be able to clear the databases using the options dialog in IE10.

Listing the stores inside a database is defined in the standard using the objectStoreNames method of an IDBDatabase instance.

EDIT 2018 This answer is no longer applicable:

webkitGetDatabaseNames() is deprecated in chrome 60


In Chrome webkit there was a function which would return all database names, this function is no longer available as of Chrome 60 (webkitgetdatabasenames):

indexedDB.webkitGetDatabaseNames().onsuccess = function(sender,args)
{ console.log(sender.target.result); };

And there is another function which list all object stores in a single database which work in all browsers:

indexedDB.open(databaseName).onsuccess = function(sender, args) 
{ console.log(sender.target.result.objectStoreNames); };

At the time of writing this post [chrome 72], You can list all the databases using following command in console of the browser. Essentially indexedDB.databases() is a Promise. You can use it to get list of all databases as an array. Run a loop on the array to get the names of databases.

indexedDB.databases().then(r => console.log(r))

Hope this helps

Since all other topics reference back here as a duplicates. In Chrome you can view and delete all created databases in Developer Tools > Application > Storage.

To view IndexedDB internals: chrome://indexeddb-internals/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!