The indexedDB attribute provides applications a mechanism for accessing capabilities of indexed databases.

    request = indexedDB . [open](#dom-idbfactory-open)(name)

    Attempts to open a to the named database with the current version, or 1 if it does not already exist. If the request is successful request’s [result](#dom-idbrequest-result) will be the .

    request = indexedDB . [open](#dom-idbfactory-open)(name, version)

    Attempts to open a connection to the named with the specified version. If the database already exists with a lower version and there are open connections that don’t close in response to a event, the request will be blocked until they all close, then an upgrade will occur. If the database already exists with a higher version the request will fail. If the request is successful request’s [result](#dom-idbrequest-result) will be the connection.

    request = indexedDB . [deleteDatabase](#dom-idbfactory-deletedatabase)(name)

    Attempts to delete the named . If the database already exists and there are open connections that don’t close in response to a event, the request will be blocked until they all close. If the request is successful request’s [result](#dom-idbrequest-result) will be null.

    result = await indexedDB . [databases](#dom-idbfactory-databases)()

    Returns a promise which resolves to a list of objects giving a snapshot of the names and versions of databases within the origin.

    This API is intended for web applications to introspect the use of databases, for example to clean up from earlier versions of a site’s code. Note that the result is a snapshot; there are no guarantees about the sequencing of the collection of the data or the delivery of the response with respect to requests to create, upgrade, or delete databases by this context or others.

    The open(name, version) method, when invoked, must run these steps:

    1. If version is 0 (zero), throw a .

    2. Let environment be this‘s .

    3. Let origin be environment’s origin.

    4. If origin is an , throw a “[SecurityError](https://heycam.github.io/webidl/#securityerror)[DOMException](https://heycam.github.io/webidl/#idl-DOMException) and abort these steps.

    5. Let request be a new .

    6. Run these steps in parallel:

      1. Let result be the result of running , with origin, name, version if given and undefined otherwise, and request.

        What happens if version is not given? If version is not given and a database with that name already exists, a connection will be opened without changing the . If version is not given and no database with that name exists, a new will be created with version equal to 1.

      2. to run these steps:

        1. If result is an error, then:

          1. Set request’s result to undefined.

          2. Set request’s to true.

          3. Fire an event named at request with its [bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles) and attributes initialized to true.

        2. Otherwise:

          1. Set request’s result to result.

          2. named success at request.

    1. Return a new [IDBOpenDBRequest](#idbopendbrequest) object for request.

    The deleteDatabase(name) method, when invoked, must run these steps:

    1. Let environment be ‘s relevant settings object.

    2. Let origin be environment’s .

    3. If origin is an opaque origin, a “[SecurityError](https://heycam.github.io/webidl/#securityerror)[DOMException](https://heycam.github.io/webidl/#idl-DOMException) and abort these steps.

    4. Let request be a new open request.

    5. Run these steps :

      1. Let result be the result of running delete a database, with origin, name, and request.

      2. Set request’s to true.

      3. Queue a task to run these steps:

        1. If result is an error, set request’s to result, set request’s done flag to true, and named error at request with its [bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles) and [cancelable](https://dom.spec.whatwg.org/#dom-event-cancelable) attributes initialized to true.

        2. Otherwise, set request’s to undefined, set request’s done flag to true, and named success at with result and null.

          Why aren’t the steps to fire a success event or used? There is no transaction associated with the request, so those steps — which activate an associated transaction before dispatch and deactivate the transaction after dispatch — do not apply.

          Also, the success event here is a [IDBVersionChangeEvent](#idbversionchangeevent) which includes the [oldVersion](#dom-idbversionchangeevent-oldversion) and [newVersion](#dom-idbversionchangeevent-newversion) details.

    6. Return a new [IDBOpenDBRequest](#idbopendbrequest) object for request.

    The databases() method, when invoked, must run these steps:

    1. Let environment be ‘s relevant settings object.

    2. Let p be .

    3. Run these steps in parallel:

      1. Let databases be the of databases in origin. If this cannot be determined for any reason, then p with an appropriate error (e.g. an “[UnknownError](https://heycam.github.io/webidl/#unknownerror)[DOMException](https://heycam.github.io/webidl/#idl-DOMException)) and terminate these steps.

      2. Let result be a new list.

      3. db of databases:

        1. Let info be a new [IDBDatabaseInfo](#dictdef-idbdatabaseinfo) dictionary.

        2. Set info’s [name](#dom-idbdatabaseinfo-name) dictionary member to db’s name.

        3. Set info’s [version](#dom-idbdatabaseinfo-version) dictionary member to db’s .

        4. Append info to result.

      4. p with result.

    4. Return p.

    🚧 The [databases()](#dom-idbfactory-databases) method is new in this edition. It is supported in Chrome 71 and Edge 79. 🚧

    result = indexedDB . [cmp](#dom-idbfactory-cmp)(key1, key2)

    Compares two values as keys. Returns -1 if key1 precedes key2, 1 if key2 precedes key1, and 0 if the keys are equal.

    Throws a “[DataError](https://heycam.github.io/webidl/#dataerror)[DOMException](https://heycam.github.io/webidl/#idl-DOMException) if either input is not a valid .

    The cmp(first, second) method, when invoked, must run these steps:

    1. Let a be the result of running convert a value to a key with first. Rethrow any exceptions.

    2. If a is invalid, a “[DataError](https://heycam.github.io/webidl/#dataerror)[DOMException](https://heycam.github.io/webidl/#idl-DOMException).

    3. Let b be the result of running convert a value to a key with second. Rethrow any exceptions.

    4. If b is invalid, a “[DataError](https://heycam.github.io/webidl/#dataerror)[DOMException](https://heycam.github.io/webidl/#idl-DOMException).