The indexedDB
read-only property of the Window
interface provides a mechanism for applications to asynchronously access the capabilities of indexed databases.
Window: indexedDB property
Value
An IDBFactory
object.
Examples
The following code creates a request for a database to be opened asynchronously, after which the database is opened when the request's onsuccess
handler is fired:
js
let db; function openDB() { const DBOpenRequest = window.indexedDB.open("toDoList"); DBOpenRequest.onsuccess = (e) => { db = DBOpenRequest.result; }; }
Specifications
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | ||
indexedDB |
24 | 12 | 1610 | 15 | 8 | 25 | 22 | 14 | 8 | 1.5 | 4.4 | |
worker_support |
24 | 12 | 37 | 15 | 10 | 25 | 37 | 14 | 10 | 1.5 | 4.4 |
See also
- Using IndexedDB
- Starting transactions:
IDBDatabase
- Using transactions:
IDBTransaction
- Setting a range of keys:
IDBKeyRange
- Retrieving and making changes to your data:
IDBObjectStore
- Using cursors:
IDBCursor
- Reference example: To-do Notifications (View the example live).
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Window/indexedDB