简体   繁体   中英

indexedDB Creating a database and adding content Failed to execute 'transaction' on 'IDBDatabase'

This is the first time for me to use indexDB, I've created a database and now trying to add content to it. But I'm getting the following error.

Uncaught NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.

I've uploaded my code on jsfiddle just because its easier to show you it running. Any suggestions please ?

https://jsfiddle.net/8kj43kyn/

// Creating an indexDB - Used to store users information.  
window.indexedDB = window.indexedDB || window.mozIndexedDB || 
window.webkitIndexedDB || window.msIndexedDB;

Should that

var transaction = db.transaction( ["books", 'readwrite']);

be

var transaction = db.transaction(["books"], 'readwrite');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM