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.

deleteDatabase

Summary

Deletes a database with the specified name.

Method of apis/indexeddb/IDBFactoryapis/indexeddb/IDBFactory

Syntax

var dbOpenRequest = window.indexeddb.deleteDatabase(name);

Parameters

name

Data-type
String

The name of the database to delete.

Return Value

Returns an object of type DOM NodeDOM Node

An IDBOpenRequest request object that fires events to indicate the result of the request.

Examples

Delete a database

var dbDeleteRequest = window.indexedDB.deleteDatabase("BookShop1");
  dbDeleteRequest.onsuccess = function(e){
    write("Database successfully deleted");

  };

  dbDeleteRequest.onerror = function(e){
    write("Error deleting DB");
  };
  dbDeleteRequest.onblocked = function(e){
    write("Deleting DB Blocked");
  };

View live example

Related specifications

W3C IndexedDB Specification
W3C Proposed Recommendation

Attributions