Skip to content
Related Articles

Related Articles

Improve Article

HTML DOM indexedDB deleteDatabase() Method

  • Last Updated : 19 Jul, 2020

The indexedDB deleteDatabase() method is used to request the deletion of a database. The method returns an IDBOpenDBRequest object immediately and performs the deletion operation asynchronously.


var request = indexedDB.deleteDatabase(name);


  • name: The name of the database you want to delete.

Return value: A IDBOpenDBRequest object after deletion.

Example: In this example, we will open a database and hence, will delete that database using this method.

    <title>indexedDB deleteDatabase() method</title>
<body style="text-align:center;">
    <h1 style="color:green;">  
    HTML | indexedDB deleteDatabase() method
    <button onclick = "Geeks()">
    Click Here
        function Geeks(){
         var request ="newDatabase", 1);
         var DBDeleteReq = 
         DBDeleteReq.onsuccess = function(event) {
              console.log("Database deleted successfully");

Before Button Click:

After Button Click: In the console, the IDBOpenDBRequest object can be seen with a successful delete message.
Also, on checking databases, an Array with 0 databases can be seen.

Supported Browsers:

  • Google Chrome
  • Edge
  • Firefox
  • Safari
  • Opera

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :