2013-05-27 76 views
0

有人可以告訴我我哪裏會出錯嗎?InvalidStateError:DOM IDBDatabase異常11

window.indexedDB = window.indexedDB || window.webkitIndexedDB || 
window.mozIndexedDB; 

if ('webkitIndexedDB' in window) { 
    window.IDBTransaction = window.webkitIDBTransaction; 
    window.IDBKeyRange = window.webkitIDBKeyRange; 
} 

var VULY_DB = {}; 
VULY_DB = {}; 
VULY_DB.db = null; 

VULY_DB.onerror = function(e) { 
    console.log(e); 
}; 

VULY_DB.open = function() { 
    var request = indexedDB.open(salt); 


    request.onerror = request.onsuccess = function(e) { VULY_DB.onerror(request.error); }; 
    request.onsuccess = function(e) { 
     VULY_DB.db = e.target.result; 
     var db = VULY_DB.db; 

     var store = db.createObjectStore("revisions", {keyPath: "id"}); 
    }; 
}; 

VULY_DB.open(); 

謝謝!

回答

2

也一般不需要使用前綴全局。我相信在Chrome的最新版本中,-webkit前綴已被刪除,您應該只使用正常的全局變量。

相關問題