IndexedDB Inspection and Debugging
You'll learn how to navigate and inspect IndexedDB databases directly in DevTools to understand stored data and troubleshoot issues.
What Is IndexedDB Inspection?
IndexedDB is a client-side database built into browsers, far more powerful than localStorage or sessionStorage. Unlike those simple key-value stores, IndexedDB supports complex data structures, indexes, and transactional operations. The Application panel in DevTools gives you a visual interface to explore these databases without writing code.
Navigating IndexedDB in DevTools
Open the Application panel and expand the IndexedDB section in the sidebar. You'll see all databases created by the current origin. Expand a database to reveal its object stores (similar to tables in SQL databases). Click any object store to view its contents in a table format.
Think of this like opening a filing cabinet (the database), pulling out a drawer (object store), and examining individual files (records).
Inspecting Data Structures
When you select an object store, DevTools displays:
- Key column: The unique identifier for each record
- Value column: The stored data (objects, arrays, primitives)
- Primary key path: Shows which property serves as the key
Click any value to expand nested objects and arrays, making it easy to verify your data structure matches expectations.
Working with Indexes
If your object store has indexes (alternate ways to query data), they appear nested under the store name. Click an index to see records sorted by that indexed property rather than the primary key. This helps verify your indexes are working correctly.
Testing and Debugging
Right-click any database, object store, or record for actions like:
- Delete database: Clear all data for testing
- Clear object store: Remove all records
- Delete record: Remove individual entries
This is invaluable when testing data persistence, debugging cache issues, or verifying data cleanup logic.
Key Takeaway: DevTools' IndexedDB inspector lets you visually browse databases, object stores, indexes, and individual records, making it easy to verify data structures and debug storage issues without writing query code.