The interface to open a database has been recently modified in the specification. Be sure to check the compatibility table to know if the browser you are using support it already.

The IDBOpenDBRequest interface of the IndexedDB API provides access to results of requests to open databases using specific event handler attributes. It is an IDBRequest with a few more attributes.

Inherits from: IDBRequest


In the following code snippet, we open a database asynchronously and make a request. Event handlers are registered for responding to various situations.

var request ='Database Name');
request.onsuccess = function(event) {
        var db = this.result;
        var transaction = db.transaction([], IDBTransaction.READ_ONLY);
        var curRequest = transaction.objectStore('ObjectStore Name').openCursor();
        curRequest.onsuccess = ...;
request.onerror = function(event) {
        switch( {
               case VER_ERR:
                    console.log("The stored database is more recent than the one needed".


Attribute Type Description
onblocked Function The event handler for the blocked event.
onupgradeneeded Function The event handler for the upgrade needed event.

Event handlers

Event handler Event handler type
onblocked error
onupgradeneeded success

Derived interface

No derived interface

Browser compatibility

  • Desktop
  • Mobile

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support -- 10.0 (10.0) -- -- --
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support -- 6.0 (6.0) ? -- --

Tags (0)

Edit tags
  • No tags

Attachments (0)


Attach file