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



Picture showing the execution of open method of IDBOpenDBRequest
Click to Enlarge


Output




Picture showing the alert message when onsuccess message is triggered
Click to Enlarge




Posted By  -  Karan Gupta
 
Posted On  -  Saturday, September 8, 2018

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250