This page is Ready to Use

Notice: The WebPlatform project has been discontinued when the Stewards partnership agreement ended in September 2015. This site has been frozen, and the assets we have created will remain.

IDBFactory

Summary

The object type for the indexedDB property, which provides access to the IndexedDB features supported by the browser and/or device.

Properties

No properties.

Methods

cmp
This method compares two specified keys. Returns 1 if the first key is greater than the second, -1 if the first is less than the second, and 0 if the first is equal to the second.
deleteDatabase
Deletes a database with the specified name.
open
The open method is used to open an IndexedDB database.

Events

No events.

Examples

The following example uses feature detection to determine whether IndexedDB is supported by the current browser/device.

function getIndexedDBHandle() {
   var oResult = null;
   if ( window.indexedDB ) {
      oResult = window.indexedDB;
   } else if ( window.mozIndexedDB ) {
      oResult = window.mozIndexedDB;
   } else if ( window.webkitIndexedDB ) {
      oResult = window.webkitIndexedDB;
   }
   return oResult;
}

var ixHandle = getIndexedDBHandle();
if ( getIndexHandle == null ) {
   doFallback();
} else {
   doIndexedDBWork(};
}

Notes

Remarks

Use the indexedDB property to access IndexedDB databases.

Important For security reasons, Internet Explorer support for the indexedDB property is limited to webpages loaded using the “http://” or “https://” protocols.

Related specifications

W3C IndexedDB Specification
W3C Proposed Recommendation

See also

External resources

}

}

Attributions