我在 FF 的不同示例之间来回尝试过,我得到的只是The operation failed for reasons unrelated to the database itself and not covered by any other error code.
我相信它是由var request = indexedDB.open("mydb",2);
var db;
var indexedDB = window.indexedDB || window.webkitIndexedDB
||window.mozIndexedDB||window.msIndexedDB;
var request = indexedDB.open("mydb",2);
customerData=[
{ssn:"444-44-4444",name:"Bill",age:35,email:"bill@company.com"},
{ssn:"555-55-5555",name:"Donna",age:32,email:"donna@home.org"}
];
request.onerror = function(event){
};
request.onupgradeneeded = function(event) {
var objectStore = db.createObjectStore("customers",{keyPath:"ssn"});
objectStore.createIndex("name","name",{unique:false});
objectStore.createIndex("email","email",{unique:true});
for(var i in customerData){
objectStore.add(customerData[i]);
}
} ;
request.onsuccess = function(e) {
} ;
谢谢