I am new to IndexedDB and I am following this IndexedDB Tutorial tutorial. I'm just trying to create a database and then I can add some records. This is what I still have.
var db = window.indexedDB.open('FriendDB', 'My Friends!'); if (db.version != '1') { // User first visit, initialize database (name, key, auto increment). db.createObjectStore('Friends', 'id', true); db.setVersion('1'); } else { // DB already initialized. } var store = db.openObjectStore('Friends'); var user = store.put({name: 'Eric', gender: 'male', likes: 'html5'});
In my console, I get the error message "Can't call the" open "method from undefined", how can I get this to work? Also, if there is a better resource on the Internet that will help me, because I can not find anything on the topic IndexedDB for beginners.
source share