Important: As of Firefox 52, the property defined in this mixin has been moved to the WindowOrWorkerGlobalScope
mixin, and other browsers will follow suit. Look to that page for up-to-date details.
The 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
objects.
IDBEnvironment.indexedDB
Read only
IDBFactory
object.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; }; }
Specification | Status | Comment |
---|---|---|
Indexed Database API The definition of 'IDBEnvironment' in that specification. | Recommendation |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 23webkit 24 | (Yes) | 10 moz 16.0 (16.0) | 10, partial | 15 | 7.1 |
Available in workers | (Yes) | (Yes) | 37.0 (37.0) | ? | (Yes) | ? |
Feature | Android | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | 4.4 | (Yes) | 22.0 (22.0) | 1.0.1 | 10 | 22 | 8 |
Available in workers | (Yes) | (Yes) | 37.0 (37.0) | (Yes) | ? | (Yes) | ? |
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.
IDBDatabase
IDBTransaction
IDBKeyRange
IDBObjectStore
IDBCursor
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/IDBEnvironment