Using requests to open a database

Internet Explorer 10 and Windows apps using JavaScript can use the indexedDB property to access supported features of the Indexed Database API (IndexedDB) specification.

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

For best results, use feature detection to access the IndexedDB API, as shown in the following example:

var ixDB; 
if ( window.indexedDB ) { 
   ixDB = window.indexedDB; 

Opening a database

When you open a database, an IDBRequest object is returned; however, the request has not yet been processed. The object is used to track the results of the request, which will be known after the requested has been processed in the background. Use this object to define event handlers that react to the results of the request, as shown in the following example:

var dbReq = "Database1" );
dbReq.onsuccess = function( evt ) {
  oDB =;

Request objects support events such as onsuccess and onerror. In the previous example, an inline function assigns the results of the request to a global variable that maintains the connection to the opened database. The result varies according to the request.

Request objects execute when they go out of scope; that is, when the current JavaScript block finishes.

IE Test Drive: Cookbook demo

Asynchronous versus synchronous

Indexed Database API ("IndexedDB")

Internet Explorer 10 Guide for Developers