Widely available Supported across all major browsers. Safe to use in production.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
24
12
16
8
25
8

The IDBCursor interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database.

24
12
16
8
25
8

The advance() method of the IDBCursor interface sets the number of times a cursor should move its position forward.

23
12
10
8
25
8

The continue() method of the IDBCursor interface advances the cursor to the next position along its direction, to the item whose key matches the optional key parameter. If no key is specified, the cursor advances to the immediate next position, based on its direction.

23
12
10
8
25
8

The continuePrimaryKey() method of the IDBCursor interface advances the cursor to the item whose key matches the key parameter as well as whose primary key matches the primary key parameter.

58
79
10
10.1
58
10.3

The delete() method of the IDBCursor interface returns an IDBRequest object, and, in a separate thread, deletes the record at the cursor's position, without changing the cursor's position. Once the record is deleted, the cursor's value is set to null.

23
12
10
8
25
8

The direction read-only property of the IDBCursor interface is a string that returns the direction of traversal of the cursor (set using IDBObjectStore.openCursor for example). See the Value section below for possible values.

23
12
10
8
25
8

The key read-only property of the IDBCursor interface returns the key for the record at the cursor's position. If the cursor is outside its range, this is set to undefined. The cursor's key can be any data type.

23
12
10
8
25
8
key (binary keys)

Binary keys

58
79
51
10.1
58
10.3

The primaryKey read-only property of the IDBCursor interface returns the cursor's current effective key. If the cursor is currently being iterated or has iterated outside its range, this is set to undefined. The cursor's primary key can be any data type.

23
12
10
8
25
8

The request read-only property of the IDBCursor interface returns the IDBRequest used to obtain the cursor.

76
79
77
15
76
15

The source read-only property of the IDBCursor interface returns the IDBObjectStore or IDBIndex that the cursor is iterating over. This function never returns null or throws an exception, even if the cursor is currently being iterated, has iterated past its end, or its transaction is not active.

23
12
10
8
25
8

The update() method of the IDBCursor interface returns an IDBRequest object, and, in a separate thread, updates the value at the current position of the cursor in the object store. If the cursor points to a record that has just been deleted, a new record is created.

23
12
10
8
25
8
worker_support

Available in workers

23
12
37
10
25
10

The IDBCursorWithValue interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property.

24
12
16
8
25
8

The value read-only property of the IDBCursorWithValue interface returns the value of the current cursor, whatever that is.

23
12
10
8
25
8
worker_support

Available in workers

23
12
42
10
25
10

The IDBDatabase interface of the IndexedDB API provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database.

24
12
16
8
25
8

The close() method of the IDBDatabase interface returns immediately and closes the connection in a separate thread.

23
12
10
8
25
8

The close event is fired on IDBDatabase when the database connection is unexpectedly closed. This could happen, for example, if the underlying storage is removed or if the user clears the database in the browser's history preferences.

30
79
50
10.1
30
10.3

The createObjectStore() method of the IDBDatabase interface creates and returns a new IDBObjectStore.

23
12
10
8
25
8

The deleteObjectStore() method of the IDBDatabase interface destroys the object store with the given name in the connected database, along with any indexes that reference it.

23
12
10
8
25
8

The name read-only property of the IDBDatabase interface is a string that contains the name of the connected database.

23
12
10
8
25
8

The objectStoreNames read-only property of the IDBDatabase interface is a containing a list of the names of the object stores currently in the connected database.

23
12
10
8
25
8

The transaction method of the IDBDatabase interface immediately returns a transaction object (IDBTransaction) containing the IDBTransaction.objectStore method, which you can use to access your object store.

23
12
10
8
25
8

The version property of the IDBDatabase interface is a 64-bit integer that contains the version of the connected database. When a database is first created, this attribute is an empty string.

23
12
10
8
25
8

The versionchange event is fired when a database structure change (upgradeneeded event send on an IDBOpenDBRequest or IDBFactory.deleteDatabase) was requested elsewhere (most probably in another window/tab on the same computer).

23
12
10
8
25
8
worker_support

Available in workers

23
12
37
10
25
10

The IDBFactory interface of the IndexedDB API lets applications asynchronously access the indexed databases. The object that implements the interface is window.indexedDB. You open — that is, create and access — and delete a database with this object, and not directly with IDBFactory.

24
12
16
8
25
8

The cmp() method of the IDBFactory interface compares two values as keys to determine equality and ordering for IndexedDB operations, such as storing and iterating.

23
12
10
8
25
8

The databases method of the IDBFactory interface returns a Promise that fulfills with an array of objects containing the name and version of all the available databases.

72
79
126
14
72
14

The deleteDatabase() method of the IDBFactory interface requests the deletion of a database. The method returns an IDBOpenDBRequest object immediately, and performs the deletion operation asynchronously.

23
12
10
8
25
8

The open() method of the IDBFactory interface requests opening a connection to a database.

23
12
10
15
25
15
worker_support

Available in workers

23
12
37
10
25
10

IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data.

24
12
16
8
25
8

The count() method of the IDBIndex interface returns an IDBRequest object, and in a separate thread, returns the number of records within a key range.

23
12
10
8
25
8

The get() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is set to an IDBKeyRange.

23
12
10
8
25
8

The getAll() method of the IDBIndex interface retrieves all objects that are inside the index.

48
79
44
10.1
48
10.3

The getAllKeys() method of the IDBIndex interface asynchronously retrieves the primary keys of all objects inside the index, setting them as the result of the request object.

48
79
44
10.1
48
10.3

The getKey() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, finds either the primary key that corresponds to the given key in this index or the first corresponding primary key, if key is set to an IDBKeyRange.

23
12
10
8
25
8

The keyPath property of the IDBIndex interface returns the key path of the current index. If null, this index is not auto-populated.

23
12
10
8
25
8

The multiEntry read-only property of the IDBIndex interface returns a boolean value that affects how the index behaves when the result of evaluating the index's key path yields an array.

23
12
10
8
25
8

The name property of the IDBIndex interface contains a string which names the index.

23
12
10
8
25
8
name (renaming through name setter)

Renaming through `name` setter

55
79
49
10.1
55
10.3

The objectStore property of the IDBIndex interface returns the object store referenced by the current index.

23
12
10
8
25
8

The openCursor() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range.

23
12
10
8
25
8

The openKeyCursor() method of the IDBIndex interface returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range, as arranged by this index.

23
12
10
8
25
8

The unique read-only property returns a boolean that states whether the index allows duplicate keys.

23
12
10
8
25
8
worker_support

Available in workers

23
12
37
10
25
10

The IDBKeyRange interface of the IndexedDB API represents a continuous interval over some data type that is used for keys. Records can be retrieved from IDBObjectStore and IDBIndex objects using keys or a range of keys. You can limit the range using lower and upper bounds. For example, you can iterate over all values of a key in the value range A–Z.

24
12
16
8
25
8

The bound() static method of the IDBKeyRange interface creates a new key range with the specified upper and lower bounds. The bounds can be open (that is, the bounds exclude the endpoint values) or closed (that is, the bounds include the endpoint values). By default, the bounds are closed.

23
12
10
8
25
8

The includes() method of the IDBKeyRange interface returns a boolean indicating whether a specified key is inside the key range.

52
79
47
10.1
52
10.3

The lower read-only property of the IDBKeyRange interface returns the lower bound of the key range.

23
12
10
8
25
8

The lowerBound() static method of the IDBKeyRange interface creates a new key range with only a lower bound. By default, it includes the lower endpoint value and is closed.

23
12
10
8
25
8

The lowerOpen read-only property of the IDBKeyRange interface returns a boolean indicating whether the lower-bound value is included in the key range.

23
12
10
8
25
8

The only() static method of the IDBKeyRange interface creates a new key range containing a single value.

23
12
10
8
25
8

The upper read-only property of the IDBKeyRange interface returns the upper bound of the key range.

23
12
10
8
25
8

The upperBound() static method of the IDBKeyRange interface creates a new upper-bound key range. By default, it includes the upper endpoint value and is closed.

23
12
10
8
25
8

The upperOpen read-only property of the IDBKeyRange interface returns a boolean indicating whether the upper-bound value is included in the key range.

23
12
10
8
25
8
worker_support

Available in workers

23
12
37
10
25
10

The IDBObjectStore interface of the IndexedDB API represents an object store in a database. Records within an object store are sorted according to their keys. This sorting enables fast insertion, look-up, and ordered retrieval.

24
12
16
8
25
8

The add() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. This is for adding new records to an object store.

23
12
10
8
25
8

The autoIncrement read-only property of the IDBObjectStore interface returns the value of the auto increment flag for this object store.

23
79
10
8
25
8

The clear() method of the IDBObjectStore interface creates and immediately returns an IDBRequest object, and clears this object store in a separate thread. This is for deleting all the current data out of an object store.

23
12
10
8
25
8

The count() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, returns the total number of records that match the provided key or IDBKeyRange. If no arguments are provided, it returns the total number of records in the store.

23
12
10
8
25
8

The createIndex() method of the IDBObjectStore interface creates and returns a new IDBIndex object in the connected database. It creates a new field/column defining a new data point for each database record to contain.

23
12
10
8
25
8

The delete() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, deletes the specified record or records.

23
12
10
8
25
8

The deleteIndex() method of the IDBObjectStore interface destroys the index with the specified name in the connected database, used during a version upgrade.

23
12
10
8
25
8

The get() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, returns the object selected by the specified key. This is for retrieving specific records from an object store.

23
12
10
8
25
8

The getAll() method of the IDBObjectStore interface returns an IDBRequest object containing all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

48
79
44
10.1
48
10.3

The getAllKeys() method of the IDBObjectStore interface returns an IDBRequest object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

48
79
44
10.1
48
10.3

The getKey() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, returns the key selected by the specified query. This is for retrieving specific records from an object store.

48
79
51
10.1
48
10.3

The index() method of the IDBObjectStore interface opens a named index in the current object store, after which it can be used to, for example, return a series of records sorted by that index using a cursor.

23
12
10
8
25
8

The indexNames read-only property of the IDBObjectStore interface returns a list of the names of indexes on objects in this object store.

23
12
10
8
25
8

The keyPath read-only property of the IDBObjectStore interface returns the key path of this object store.

23
12
10
8
25
8

The name property of the IDBObjectStore interface indicates the name of this object store.

23
12
10
8
25
8
name (renaming through name setter)

Renaming through `name` setter

55
≤18
49
10.1
55
10.3

The openCursor() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, returns a new IDBCursorWithValue object. Used for iterating through an object store with a cursor.

23
12
10
8
25
8

The openKeyCursor() method of the IDBObjectStore interface returns an IDBRequest object whose result will be set to an IDBCursor that can be used to iterate through matching results. Used for iterating through the keys of an object store with a cursor.

23
79
44
10.1
25
10.3

The put() method of the IDBObjectStore interface updates a given record in a database, or inserts a new record if the given item does not already exist.

23
12
10
8
25
8

The transaction read-only property of the IDBObjectStore interface returns the transaction object to which this object store belongs.

23
12
10
8
25
8
worker_support

Available in workers

23
12
37
10
25
10

The IDBOpenDBRequest interface of the IndexedDB API provides access to the results of requests to open or delete databases (performed using IDBFactory.open and IDBFactory.deleteDatabase), using specific event handler attributes.

24
12
16
8
25
8

The blocked handler is executed when an open connection to a database is blocking a versionchange transaction on the same database.

23
12
10
8
25
8

The upgradeneeded event is fired when an attempt was made to open a database with a version number higher than its current version.

23
12
10
8
25
8
worker_support

Available in workers

23
12
37
10
25
10

The IDBRequest interface of the IndexedDB API provides access to results of asynchronous requests to databases and database objects using event handler attributes. Each reading and writing operation on a database is done using a request.

24
12
16
8
25
8

The error read-only property of the IDBRequest interface returns the error in the event of an unsuccessful request.

23
12
10
8
25
8

The error handler is executed when an error caused a request to fail. In the error event handler, you can access the error of the request, as well as place more requests to the same transaction.

23
12
10
8
25
8
error (DOMException)

`DOMException` value instead of `DOMError`

48
≤18
58
48

The readyState read-only property of the IDBRequest interface returns the state of the request.

23
12
10
8
25
8

The result read-only property of the IDBRequest interface returns the result of the request.

23
12
10
8
25
8

The source read-only property of the IDBRequest interface returns the source of the request, such as an Index or an object store. If no source exists (such as when calling IDBFactory.open), it returns null.

23
12
10
8
25
8

The success event is fired when an IDBRequest succeeds. In the success event handler, you can access the result of the request, as well as place more requests to the same transaction.

23
12
10
8
25
8

The transaction read-only property of the IDBRequest interface returns the transaction for the request, that is, the transaction the request is being made inside.

23
12
10
8
25
8
worker_support

Available in workers

23
12
37
10
25
10

The IDBTransaction interface of the IndexedDB API provides a static, asynchronous transaction on a database using event handler attributes. All reading and writing of data is done within transactions. You use IDBDatabase to start transactions, IDBTransaction to set the mode of the transaction (e.g., is it readonly or readwrite), and you access an…

24
12
16
8
25
8

The abort() method of the IDBTransaction interface rolls back all the changes to objects in the database associated with this transaction.

23
12
10
8
25
8

The abort event is fired when an IndexedDB transaction is aborted.

23
12
10
8
25
8

The commit() method of the IDBTransaction interface commits the transaction if it is called on an active transaction.

76
79
74
15
76
15

The complete event of the IndexedDB API is fired when the transaction has successfully committed, which is either after you explicit call IDBTransaction.commit() or when all requests have been successfully completed, and after handling their results, no new requests have been placed. See IDBTransaction for more information.

23
12
10
8
25
8

The db read-only property of the IDBTransaction interface returns the database connection with which this transaction is associated.

23
12
10
8
25
8

The durability read-only property of the IDBTransaction interface returns the durability hint the transaction was created with. This is a hint to the user agent of whether to prioritize performance or durability when committing the transaction.

83
83
126
15
83
15

The IDBTransaction.error property of the IDBTransaction interface returns the type of error when there is an unsuccessful transaction.

23
12
10
8
25
8

The error event is fired on IDBTransaction when a request returns an error and the event bubbles up to the transaction object.

23
12
10
8
25
8
error (DOMException)

`DOMException` value instead of `DOMError`

48
≤18
58
48

The mode read-only property of the IDBTransaction interface returns the current mode for accessing the data in the object stores in the scope of the transaction (i.e., is the mode to be read-only, or do you want to write to the object stores?) The default value is readonly.

23
12
10
8
25
8

The objectStore() method of the IDBTransaction interface returns an object store that has already been added to the scope of this transaction.

23
12
10
8
25
8

The objectStoreNames read-only property of the IDBTransaction interface returns a DOMStringList of names of IDBObjectStore objects.

48
79
10
10.1
48
10.3
worker_support

Available in workers

23
12
37
10
25
10

The IDBVersionChangeEvent interface of the IndexedDB API indicates that the version of the database has changed, as the result of an IDBOpenDBRequest.upgradeneeded_event event handler function.

24
12
16
8
25
8

The IDBVersionChangeEvent() constructor creates a new IDBVersionChangeEvent object, which is used to represent when a version of the database has changed, as a result of the IDBOpenDBRequest.upgradeneeded_event event handler.

41
79
25
10
41
10

The newVersion read-only property of the IDBVersionChangeEvent interface returns the new version number of the database.

23
12
10
8
25
8

The oldVersion read-only property of the IDBVersionChangeEvent interface returns the old version number of the database.

23
12
10
8
25
8
worker_support

Available in workers

23
12
37
10
25
10
worker_support

Available in workers

24
12
37
10
25
10
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (23)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (23)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (23)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (23)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 4 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (15)
  • This feature was removed in a later browser version (14)
Implementation note
  • In some releases of Safari 14, the first `indexedDB.open()` call hangs forever, see bug 226547.
Notes 4 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (15)
  • This feature was removed in a later browser version (14)
Implementation note
  • In some releases of Safari on iOS 14, the first `indexedDB.open()` call hangs forever, see bug 226547.
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (23)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (23)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (23)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (23)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (2)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (23)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (57)
Compatibility
  • Available with a vendor prefix: webkit (25)
Notes 1 item(s)
Compatibility
  • Available with a vendor prefix: webkit (12)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (16)
Compatibility
  • Available with a vendor prefix: moz (10)
Notes 1 item(s)
Compatibility
  • Available with a vendor prefix: webkit (18)

Syntax

JAVASCRIPT
let db;
function openDB() {
  const DBOpenRequest = window.indexedDB.open("toDoList");
  DBOpenRequest.onsuccess = (e) => {
    db = DBOpenRequest.result;
  };
}

Use cases

  • Using IndexedDB

    The indexedDB read-only property of the Window interface provides a mechanism for applications to

Cautions

  • May not be supported in older browsers.

Implementation notes

  • Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.