{{APIRef()}}
The IDBEnvironment
interface of the IndexedDB API provides asynchronous access to a client-side database. It is implemented by {{domxref("window")}} and {{domxref("Worker")}} objects.
Properties
- {{domxref("IDBEnvironment.indexedDB")}} {{readonlyInline}}
- Provides a mechanism for applications to asynchronously access capabilities of indexed databases; contains an {{domxref("IDBFactory")}} object.
Example
The following code opens a database asynchronously and makes a request.
var db; function openDB() { var DBOpenRequest = window.indexedDB.open("toDoList"); DBOpenRequest.onsuccess = function(e) { db = request.result; } }
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('IndexedDB', '#idl-def-IDBEnvironment', 'IDBEnvironment')}} | {{Spec2('IndexedDB')}} |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 12{{property_prefix("webkit")}} 23 |
{{CompatGeckoDesktop("2.0")}} | 10 | 17 | {{CompatNo}} |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 4.4 | {{CompatGeckoMobile("6.0")}} | 1.0.1 | 10 | 17 | {{CompatNo}} |
Be careful in Chrome as it still implements the old specification along with the new one. Similarly it still has the prefixed webkitIndexedDB
property even if the unprefixed indexedDB
is present.
See also
To learn more about various topics, see the following
- Starting transactions: {{domxref("IDBDatabase")}}
- Setting transaction modes: {{domxref("IDBTransaction")}}
- Setting a range of keys: {{domxref("IDBKeyRange")}}
- Creating cursors: {{domxref("IDBIndex")}}
- The reference application for the examples in this reference: To-do Notifications (view example live.)