我已經試過來回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);
錯誤「操作失敗無關的數據庫原因......」在Firefox
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:"[email protected]"},
{ssn:"555-55-5555",name:"Donna",age:32,email:"[email protected]"}
];
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) {
} ;
謝謝
是的,我實際上在答案之前計算出來:)但在網絡服務器上它工作。感謝 – Johan 2012-08-11 22:45:41
你是快男:)你是什麼意思的「網絡服務器」? – CoR 2012-08-12 08:31:06
這意味着,IndexedDB只能通過http(s):// URLs,而不是file://這意味着,恕我直言,這個答案是錯誤的,以下權利。 – mcepl 2012-11-04 19:41:19