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.

close

Summary

This method synchronously performs the steps for closing a database connection and returns once the database has been closed.

Method of apis/indexeddb/IDBDatabaseapis/indexeddb/IDBDatabase

Syntax

 database.close();

Return Value

No return value

Examples

var dbOpenRequest = window.indexedDB.open("BookShop1");
dbOpenRequest.onsuccess = function(event){
    var db = dbOpenRequest.result;
    // The database is now opened
    db.close(); // Close the database connection
};

View live example

Usage

 This is a synchronous method that returns after the connection to the database is closed.

Related specifications

W3C IndexedDB Specification
W3C Proposed Recommendation

Attributions