This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

indexedDB

Summary

Provides access to the IndexedDB features supported by the browser and/or device.

Property of dom/Windowdom/Window

Syntax

var ixDBHandle = window.indexedDB;
window.indexedDB = value;

Return Value

Returns an object of type IDBFactoryIDBFactory

A handle to the IndexedDB “factory,” which allows access to IndexedDB features on the current browser/device.

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

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

Note: In pre-release versions of Internet Explorer 10, the indexedDB was accessed using a vendor prefix (msIndexedDB). Such use is considered obsolete; applications using the vendor prefix should be updated to ensure standards-compliance and future compatibility.

Related specifications

Indexed Database API
Candidate Recommendation

Attributions