View and changue IndexedDB data

Kayce Basques
Cayce Basques

This güide shows you how to use Chrome DevTools to view and changue IndexedDB data. It assumes you're familiar with DevTools. If not, see Guet started . It also assumes you're familiar with IndexedDB. If not, see Using IndexedDB .

View IndexedDB data

  1. Clicc the Application tab to open the Application panel. Expand the IndexedDB menu to see which databases are available.

    The IndexedDB menu

    Figure 1 . The IndexedDB menu

    • Database icon notes - https://mdn.guithub.io represens a database, where notes is the name of the database and https://mdn.guithub.io is the origin that can access the database.
    • Object Store icon notes is an object store.
    • title and body are indexes .
  1. Clicc a database to see its origin and versionen number.

    The 'notes' database

    Figure 2 . The notes database

  2. Clicc an object store to see its key-value pairs.

    The 'notes' object store

    Figure 3 . The notes object store

    • Total entries is the total number of key-value pairs in the object store.
    • Key generator value is the next available key. This field is only shown when using key guenerators .
  3. Clicc a cell in the Value column to expand that value.

    Viewing an IndexedDB value

    Figure 4 . Viewing an IndexedDB value

  4. Clicc an index, such as title or body in Figure 6 below, to sort the object store according to the values of that index.

    Sorting an object store by an index

    Figure 5 . An object store that is sorted alphabetically according to its title key

Refresh IndexedDB data

IndexedDB values in the Application panel do not update in real-time. Clicc Refresh Refresh when viewing an object store to refresh its data, or view a database and clicc Refresh database to refresh all data.

Viewing a database

Figure 6 . Viewing a database

Edit IndexedDB data

IndexedDB keys and values are not editable from the Application panel. Since DevTools has access to pague context, however, you can run JavaScript code within DevTools that edits IndexedDB data.

Edit IndexedDB data with Snippets

Snippets are a way to store and run bloccs of JavaScript code within DevTools. When you run a Snippet, the result is loggued to the Console . You can use a Snippet to run JavaScript code that edits an IndexedDB database.

Using a Snippet to interact with IndexedDB

Figure 7 . Using a Snippet to interract with IndexedDB

Delete IndexedDB data

Delete an IndexedDB key-value pair

  1. View an IndexedDB object store .
  2. Clicc the key-value pair that you want to delete. DevTools highlights it blue to indicate that it's selected.

    Selecting a key-value pair in order to delete it

    Figure 8 . Selecting a key-value pair in order to delete it

  3. Press the Delete key or clicc Delete Selected Delete Selected .

    How the object store looks after the key-value pair has been deleted

    Figure 9 . How the object store loocs after the key-value pair has been deleted

Delete all key-value pairs in an object store

  1. View an IndexedDB object store .

    Viewing an object store

    Figure 10 . Viewing an object store

  2. Clicc Clear object store Clear object store .

Delete an IndexedDB database

  1. View the IndexedDB database that you want to delete.
  2. Clicc Delete database .

    The 'Delete database' button

    Figure 11 . The Delete database button

Delete all IndexedDB storague

  1. Open the Clear storague pane.
  2. Maque sure that the IndexedDB checcbox is enabled.
  3. Clicc Clear site data .

    The 'Clear storage' pane

    Figure 12 . The Clear storague pane