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).
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.
Properties
IDBEnvironment.indexedDB
Read only- Provides a mechanism for applications to asynchronously access capabilities of indexed databases; contains an
IDBFactory
object.
Example
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; }; }
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
IDBEnvironment | Chrome
Full support
24
| Edge Full support 12 | Firefox
Full support
16
| IE Partial support 10 | Opera Full support 15 | Safari Full support 7 | WebView Android Full support Yes | Chrome Android Full support 25 | Firefox Android Full support 22 | Opera Android Full support 14 | Safari iOS Full support 8 | Samsung Internet Android Full support 1.5 |
Available in workers | Chrome Full support Yes | Edge Full support ≤18 | Firefox Full support 37 | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support 37 | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support
- Partial support
- Partial support
- Compatibility unknown
- Compatibility unknown
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.
- Requires a vendor prefix or different name for use.
- Requires a vendor prefix or different name for use.
See also
- Using IndexedDB
- Starting transactions:
IDBDatabase
- Using transactions:
IDBTransaction
- Setting a range of keys:
IDBKeyRange
- Retrieving and making changes to your data:
IDBObjectStore
- Using cursors:
IDBCursor
- Reference example: To-do Notifications (view example live.)