Articles → HTML 5 → IDBOpenDBRequest Interface Of IndexedDB
IDBOpenDBRequest Interface Of IndexedDB
Purpose
Example
var db;
// Let us open our database
var DBOpenRequest = window.indexedDB.open("toDoList", 4);
// these two event handlers act on the database being
// opened successfully, or not
DBOpenRequest.onerror = function(event) {
alert("Error loading database");
};
DBOpenRequest.onsuccess = function(event) {
alert("Database initialized");
// store the result of opening the database.
db = DBOpenRequest.result;
};
Try It
Click to Enlarge
Output
Click to Enlarge