indexedDB property

Allows access to the Indexed Database API, as implemented by a Windows Store app using JavaScript.

This property is read-only.

Syntax

JavaScript
hIndexedDB = object.indexedDB

Property values

Type: IDBFactory

A reference to the access object.

Standards information

Remarks

For security reasons, support for the indexedDB property is limited to Windows Store apps and to webpages loaded using the "http://" or "https://" protocols.

To troubleshoot webpages that incorporate IndexedDB features before uploading them to a public server, use a local web server to preview the pages using the loopback address (127.0.0.1).

Note  In pre-release versions of a Windows Store app using JavaScript, 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.

Examples

This example shows how to open an IndexedDB database.


try {

  var db = null; 
  var sName = "ADatabase";
  var nVersion = 1.0;

  if (window.indexedDB) {

    var req = window.indexedDB.open( sName, nVersion );

    req.onsuccess = function(evt) { 
       db = evt.target.result;
       doSomething( db );
    }    	  
    req.onerror = handleError( evt );
    req.onblocked = handleBlock( evt );
    req.onupgradeneeded = handleUpgrade( evt );

  } catch( ex ) {
    handleException( ex );
  }

See also

Window
Worker
WorkerGlobalScope
onsuccess
onerror
onblocked
onupgradeneeded

 

 

Show:
© 2014 Microsoft