我有一个 HTML5 数据库App.val.DB
,我想在使用App.val.DB.readTransaction
. 这在 BlackBerry/PlayBook/Chrome 上运行良好,但在 Android 上(在 WebView 内)会导致以下 TypeError 异常。
06-21 00:36:07.276: D/NotepadActivity(387): TypeError: Result of expression 'App.val.DB.readTransaction' [undefined] is not a function. -- From line 271 of file:///android_asset/script/main.js
以下是相关的 JavaScript:
if(App.val.DB != null) {
App.val.DB.readTransaction(
function (t) {t.executeSql("SELECT * FROM " + App.schema.tableName + " ORDER BY "+App.schema.date+" DESC, "+App.schema.ID+" DESC",
[],
function (t, res) { /* Success */
App.log("Success");
},
function (t, err) { /* Error */
App.log("Fail");
}
);
}
);
} else {
App.log("Database was NULL");
}