【问题标题】:Android browser does support indexed database?Android浏览器是否支持索引数据库?
【发布时间】:2013-09-30 20:15:39
【问题描述】:

我用 phonegap 写了一个 android 应用程序。我想使用 indexedDB,但我总是遇到异常。 NOT_FOUND_ERR:DOM IDBDatabase 异常 3:264

当我初始化 indexedDB 时,我没有收到错误:

//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 上的桌面浏览器上运行,但它不能在平板电脑上运行。我已经在我的 PC 上的 Chrome 和 Firefox 浏览器上进行了测试。

我该如何解决这个问题

【问题讨论】:

    标签: android html cordova indexeddb


    【解决方案1】:

    根据我的测试,Android 4.1(及更高版本)在 Web 客户端和股票浏览器中都有 IndexedDB。实现是错误的,不完整的和过时的。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-22
      • 1970-01-01
      • 2013-08-09
      • 2011-06-12
      • 2014-10-05
      • 2011-12-12
      • 2011-11-13
      • 2011-09-07
      相关资源
      最近更新 更多