databases 方法在 IDBFactory interface returns a list represening all the available databases, including their names and versions.

注意: 此特征可用于 Web 工作者 .

注意 : This method is introduced in a draft of a specifications and browser compatibility is limited.

句法

const promise = indexedDB.databases()
				

参数

The method does not take in any parameters.

返回值

A promise that resolves either to an error or a list of dictionaries, each with two elements, 名称 and version .

名称

The database name.

version

The database version.

异常

此方法可能引发 DOMException of the following types:

属性 描述
SecurityError The method is called from an opaque origin.
Other error Specification does not describe all possible errors.

范例

const promise = indexedDB.databases()
promise.then(databases => {
  console.log(databases)
})
					

规范

规范 状态 注释
索引数据库 API 草案
The definition of 'databases()' in that specification.
推荐 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
databases Chrome 71 Edge 79 Firefox No
不支持 No
bug 934640 .
IE No Opera 58 Safari No WebView Android 71 Chrome Android 71 Firefox Android No
不支持 No
bug 934640 .
Opera Android Yes Safari iOS No Samsung Internet Android 10.0

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

见实现注意事项。

另请参阅

元数据

  • 最后修改: