Table of contents
IndexedDB is an API for client-side storage of significant amounts of structured data and for high performance searches on this data using indexes. While DOM Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solution.
IndexedDB provides separate APIs for synchronous and asynchronous access.
About this document
This reference documentation lists the interfaces and methods of the IndexedDB API.
For an introduction to essential concepts and terminology, see Basic Concepts About IndexedDB. For a tutorial on how to use the API, see Using IndexedDB. For an example of using IndexedDB, see A simple TODO list using HTML5 IndexedDB.
Asynchronous API
The asynchronous API methods return without blocking the calling thread. To get asynchronous access to a database, call open() on the indexedDB attribute of a window object. This method returns an IDBRequest object; asynchronous operations communicate to the calling application by firing events on IDBRequest objects.
- IDBCursor iterates over object stores and indexes.
- IDBDatabase represents a connection to a database. It's the only way to get a transaction on the database.
- IDBFactory provides access to a database. It is implemented by window objects.
- IDBEnvironment provides access to a client-side database. It is implemented by window objects.
- IDBIndex provides access to the metadata of an index.
- IDBObjectStore represents an object store.
- IDBRequest provides access to results of asynchronous requests to databases and database objects. It is what you get when you call an asynchronous method.
- IDBTransaction represents a transaction. You create a transaction on a database, specify the scope (such as which object stores you want to access), and determine the kind of access (read only or write) you want.
- IDBVersionChangeEvent indicates that the version of the database has changed.
- IDBVersionChangeRequest represents a request to change the version of a database.
Synchronous API
To get synchronous access to a database, call open() on the
Unimplemented
indexedDBSync attribute of a worker object. This returns an IDBDatabaseSync object, which enables you to create, open, and remove object stores and indexes, set the version of the database, and create transactions.
- IDBCursorSync iterates over object stores and indexes.
- IDBDatabaseSync represents a connection to a database. It's the only way to get a transaction on the database.
- IDBEnvironmentSync provides access to a client-side database. It is implemented by worker objects.
- IDBFactorySync provides access to a database. It is implemented by worker objects.
- IDBIndexSync provides access to the metadata of an index.
- IDBObjectStoreSync represents an object store.
- IDBTransactionSync creates a transaction in the database.
Shared interfaces
The following interfaces are used by both the synchronous and the asynchronous APIs.
- IDBDatabaseException represents exception conditions that can be encountered while performing database operations.
- IDBKeyRange defines a range of keys.
Example
See live example.
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Asynchronous API | 12 -webkit | 4.0 (2.0) | -- | -- | -- |
| Synchronous API (used with WebWorkers) | -- | -- See bug 553412 | -- | -- | -- |
| Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Asynchronous API | -- | 6.0 (6.0) | -- | -- | -- |
Storage limits
For Google Chrome, you can have up to 5 MB of storage, by default. Installed apps can have unlimited storage if you set your manifest file to have unlimited storage and your user grants that permission to your app.

