indexedDB 只读特性在 WindowOrWorkerGlobalScope mixin provides a mechanism for applications to asynchronously access the capabilities of indexed databases.

句法

var IDBFactory = self.indexedDB;
					

IDBFactory 对象。

范例

The following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess handler is fired:

var db;
function openDB() {
 var DBOpenRequest = window.indexedDB.open('toDoList');
 DBOpenRequest.onsuccess = function(e) {
   db = DBOpenRequest.result;
 }
}
					

规范

规范 状态 注释
索引数据库 API 草案
The definition of 'indexedDB' in that specification.
推荐 Defined in a WindowOrWorkerGlobalScope partial in the newest spec.
索引数据库 API 2.0
The definition of 'indexedDB' 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
indexedDB Chrome 24 Edge 12 Firefox 16
16
10 Prefixed
Prefixed Implemented with the vendor prefix: moz
52 注意事项
indexedDB now defined on WindowOrWorkerGlobalScope 混合。
IE 部分支持 10 Opera 15 Safari 7 WebView Android Yes Chrome Android 25 Firefox Android 22
22
52 注意事项
indexedDB now defined on WindowOrWorkerGlobalScope 混合。
Opera Android 14 Safari iOS 8 Samsung Internet Android 2.0
Available in workers Chrome Yes Edge ≤18 Firefox 37 IE ? Opera Yes Safari ? WebView Android Yes Chrome Android Yes Firefox Android 37 Opera Android Yes Safari iOS ? Samsung Internet Android Yes

图例

完整支持

完整支持

部分支持

部分支持

兼容性未知 ?

兼容性未知

见实现注意事项。

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

另请参阅

元数据

  • 最后修改: