November 2011
Intermediate to advanced
384 pages
13h 23m
English
Before creating a new IndexedDB object store, first attempt to read something from it. This will throw an exception error with the code NOT_FOUND_ERR. This is your cue to create the object store by calling db.setVersion() and db.createObjectStore().
Before you begin, you must set an object store name. This can literally be anything, but remember that the information you save to the IndexedDB API will be under this store name, housed within the database name you picked earlier. Because you will be referring to this store name several times, store it as a global variable alongside var db:
var objectStore ='myStore';
The store exception test must be placed within the openDB. onsuccess function, after db = ...
Read now
Unlock full access