IDBEnvironment

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Important : The indexedDB property that was previously defined in this mixin is instead now WindowOrWorkerGlobalScope.indexedDB (that is, defined as a member of the WindowOrWorkerGlobalScope mixin).

IDBEnvironment helper of the IndexedDB API contains the indexedDB property, which provides access to IndexedDB functionality. It is the top level IndexedDB interface implemented by the window and Worker 对象。

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

特性

IDBEnvironment.indexedDB 只读
Provides a mechanism for applications to asynchronously access capabilities of indexed databases; contains an 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;
 };
}
					

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
IDBEnvironment
弃用 非标
Chrome 24
24
23 — 57
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge 12 Firefox 16
16
10 — 16
Prefixed
Prefixed Implemented with the vendor prefix: moz
IE 部分支持 10 Opera 15 Safari 7 WebView Android Yes Chrome Android 25 Firefox Android 22 Opera Android 14 Safari iOS 8 Samsung Internet Android 1.5
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

图例

完整支持
完整支持
部分支持
部分支持
兼容性未知
兼容性未知
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
弃用。不要用于新网站。
要求使用供应商前缀或不同名称。
要求使用供应商前缀或不同名称。

另请参阅

  1. IDBEnvironment