此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

IDBFactory

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015年7月⁩.

* Some parts of this feature may have varying levels of support.

IndexedDB APIIDBFactory 接口让程序可以异步存取 indexed databases。window.indexedDB 对象实现了这个接口。你可以通过这个对象而不是直接使用IDBFactory接口打开——创建或者连接——和删除一个数据库。

Methods

IDBFactory.open

请求打开一个数据库的连接(connection to a database)。

IDBFactory.deleteDatabase

请求删除数据库。

IDBFactory.cmp

比较两个键的方法并返回一个结果,表明哪个值更大。

过时的 Methods

IDBFactory.open, the original version 已弃用

一个被废弃的方法请求打开一个数据库的连接,仍然在一些浏览器中被实施 (connection to a database).

Example

In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. For a full working example, see our To-do Notifications app (view example live.)

Specifications

Specification
Indexed Database API 3.0
# factory-interface

Browser compatibility

See also