2013-09-30 36 views
0

我用手机写了一个android应用程序。我想使用indexedDB,但我总是得到一个异常。 NOT_FOUND_ERR:DOM IDBDatabase例外3:264Android浏览器确实支持索引数据库吗?

当我初始化索引资料我没有得到一个错误:

//todo csinálni kell inicializált eventet 

// In the following line, you should include the prefixes of implementations you want to test. 
window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; 
// DON'T use "var indexedDB = ..." if you're not in a function. 
// Moreover, you may need references to some window.IDB* objects: 
window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction; 
window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange; 
// (Mozilla has never prefixed these objects, so we don't need window.mozIDB*) 

if (!window.indexedDB) { 
    window.alert("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available."); 
} 

,当我登录了IndexedDB的我得到[object IDBDatabase]

我得到的错误在这行:var trans = db.transaction([index], "readwrite");

我的代码工作在上PC上的桌面浏览器,它只是没有在平板电脑上运行。我在我的电脑上通过Chrome和Firefox浏览器进行了测试。

我怎样才能解决这个问题

回答

0

从我的测试中,搭载Android 4.1(及以上)有IndexedDB的两个Web客户端和浏览器的股票。虽然这个实现是错误的,不完整和过时的。

而不是“读取”,使用旧样式window.webkitIDBTransaction.READ_WRITE