HTML DOM indexedDB deleteDatabase() Method
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.
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.
- Google Chrome
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.