The indexedDB
read-only property of the WindowOrWorkerGlobalScope
mixin provides a mechanism for applications to asynchronously access the capabilities of indexed databases.
Syntax
var IDBFactory = self.indexedDB;
Value
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; } }
Specifications
Specification | Status | Comment |
---|---|---|
Indexed Database API Draft The definition of 'indexedDB' in that specification. |
Recommendation | Defined in a WindowOrWorkerGlobalScope partial in the newest spec. |
Indexed Database API 2.0 The definition of 'indexedDB' in that specification. |
Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
indexedDB | 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 2.0 |
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
- See implementation notes.
- See implementation notes.
- 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.)