在chrome中,我使用window.indexedDB.databases()
方法来获取所有indexedDb名称。
但是同样的方法在 Firefox 中不起作用。
我也会尝试window.indexedDB.databases()
类似的方法,例如window.indexedDB.webkitdatabases()
和window.indexedDB.mozwebkitdatabases()
.
对于上述方法的实现会出现以下错误。
window.indexedDB.databases() is not a function.
此外,我将尝试使用 IndexedDB 接口(interface),如 IDBObjectStore、IDBDataBase...等。但没有任何用处。他们还在实现中给出了错误。
请提供一些正确的方法或建议来获取所有indexedDB名称。
最佳答案
IDBFactory 中有一个方法可以为您提供数据库列表。
IDBFactory.databases A method that returns a list of all available databases, including their names and versions.
https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory 但实际上并没有实现! 您可以在firefox bug report中阅读更多相关内容。
因此获取数据库名称的唯一方法是使用Storage Inspector在 Firefox DevTools 中。
关于javascript - firefox中有没有函数可以获取所有indexedDB名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69118042/