what’s wrong with this code in Google Chrome
r = webkitIndexedDB.open(db_name,1);
r.onsuccess = success_callback;
r.onerror = error_callback;
r.onupgradeneeded = function(e){
var db = e.currentTarget.result;
db.createObjectStore('os_name',{keyPath:id,autoIncrement:true});
};
it’s works in firefox (mozIndexedDB) but not in chrome. even onerror won’t be triggered. anyway i get this error
Uncaught Error: NOT_FOUND_ERR: DOM IDBDatabase Exception 3
onupgradeneededis not supported function in Google Chrome, instead you should use thesetversionmethod for initiating the database in the beginning ofonsuccessevent on database opening as described here:http://www.html5rocks.com/en/tutorials/indexeddb/todo/#toc-step2
Your code should look something like this:
Edit November 2013: This is a obsolete answer now, since Google Chrome only supports upgrade of the database with the
onupgradeneededevent.