Saturday, December 28, 2024
Google search engine
HomeLanguagesJavascriptHTML DOM indexedDB databases() Method

HTML DOM indexedDB databases() Method

The databases() method of the indexedDB interface returns a list representing all the available databases in the document, with their names and versions.

Syntax:

dbs = indexedDB.databases();

Parameters: The method does not take any parameters.
Return value: This method returns a promise containing a list of dictionaries, each with two elements, name and version.
Example: In this example, we will open a database and hence, will get the databases using this method.




<!DOCTYPE HTML> 
<html>  
<head>
    <title>indexedDB databases() method</title>
</head>   
<body style="text-align:center;">
    <h1 style="color:green;">  
        neveropen  
    </h1
    <p
    HTML | indexedDB databases() method
    </p>
    <button onclick = "Geeks()">
    Click Here
    </button>   
    <script
        function Geeks(){
         var request = 
           window.indexedDB.open("newDatabase", 1);
         console.log(window.indexedDB.databases())
     }
  </script
</body>   
</html>


Output:

Before Button Click:

After Button Click: In the console, the promise can be seen.

Supported Browsers:

  • Google Chrome
  • Edge
  • Firefox
  • Safari
  • Opera
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments