WindowOrWorkerGlobalScope.indexedDB

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

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
indexedDBChrome Full support 24Edge Full support 12Firefox Full support 16
Full support 16
Full support 10
Prefixed
Prefixed Implemented with the vendor prefix: moz
Full support 52
Notes
Notes indexedDB now defined on WindowOrWorkerGlobalScope mixin.
IE Partial support 10Opera Full support 15Safari Full support 7WebView Android Full support YesChrome Android Full support 25Firefox Android Full support 22
Full support 22
Full support 52
Notes
Notes indexedDB now defined on WindowOrWorkerGlobalScope mixin.
Opera Android Full support 14Safari iOS Full support 8Samsung Internet Android Full support 2.0
Available in workersChrome Full support YesEdge Full support ≤18Firefox Full support 37IE ? Opera Full support YesSafari ? WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 37Opera Android Full support YesSafari 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