Tutorial by Examples

You can test for IndexedDB support in the current environment by checking for the presence of the window.indexedDB property: if (window.indexedDB) { // IndexedDB is available }
Opening a database is an asynchronous operation. We need to send a request to open our database and then listen for events so we know when it's ready. We'll open a DemoDB database. If it doesn't exist yet, it will get created when we send the request. The 2 below says that we're asking for version...
Anything that needs to happen with data in an IndexedDB database happens in a transaction. There are a few things to note about transactions that are mentioned in the Remarks section at the bottom of this page. We'll use the database we set up in Opening a database. // Create a new readwrite (sinc...
Anything that needs to happen with data in an IndexedDB database happens in a transaction. There are a few things to note about transactions that are mentioned in the Remarks section at the bottom of this page. We'll use the database we set up in Opening a database. // Create a new transaction, we...

Page 1 of 1