--- title: WindowOrWorkerGlobalScope.indexedDB slug: Web/API/indexedDB tags: - API - Database - IndexedDB - Reference - Storage - WindowOrWorkerGlobalScope - 参考 - 属性 translation_of: Web/API/WindowOrWorkerGlobalScope/indexedDB original_slug: Web/API/WindowOrWorkerGlobalScope/indexedDB ---
{{ APIRef() }}
indexedDB
是 {{domxref("WindowOrWorkerGlobalScope")}}的一个只读属性,它集成了为应用程序提供异步访问索引数据库的功能的机制。.
var IDBFactory = self.indexedDB;
一个 {{domxref("IDBFactory")}} 对象.
示例
var db; function openDB() { var DBOpenRequest = window.indexedDB.open('toDoList'); DBOpenRequest.onsuccess = function(e) { db = DBOpenRequest.result; } }
Specification | Status | Comment |
---|---|---|
{{SpecName('IndexedDB 2', '#dom-windoworworkerglobalscope-indexeddb', 'indexedDB')}} | {{Spec2('IndexedDB 2')}} | Defined in a WindowOrWorkerGlobalScope partial in the newest spec. |
{{SpecName('IndexedDB', '#widl-IDBEnvironment-indexedDB', 'indexedDB')}} | {{Spec2('IndexedDB')}} | Initial definition. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 23{{property_prefix("webkit")}} 24 |
{{CompatVersionUnknown}} | 10 {{property_prefix("moz")}} {{CompatGeckoDesktop("16.0")}} {{CompatGeckoDesktop("52.0")}}[1] |
10, partial | 15 | 7.1 |
Available in workers | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("37.0")}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} |
Indexed Database 2.0 | {{CompatChrome(58)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatOpera(45)}} | {{CompatUnknown}} |
Feature | Android Webview | Chrome for Android | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("22.0")}} {{CompatGeckoMobile("52.0")}}[1] |
1.0.1 | 10 | 22 | 8 |
Available in workers | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("37.0")}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} |
Indexed Database 2.0 | {{CompatChrome(58)}} | {{CompatChrome(58)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatOperaMobile(45)}} | {{CompatUnknown}} |
[1] indexedDB
定义在 {{domxref("WindowOrWorkerGlobalScope")}} mixin(一种实现多继承的方法)上.