我正在开发一个移动应用程序,为此我将 html5/js 与 Phonegap 结合使用。 我使用 window.openDatabase(...) 将一些数据存储在本地数据库中。
这在 Android 2.x 上工作正常但是当我尝试使用 Android 4.0.3 时,我发现了以下错误:
D/CordovaLog(698): Uncaught TypeError: Object [object DOMWindow] 没有方法 'openDatabase'
我的代码是:
if (!window.openDatabase)
alert("Error: can't open local database");
if (!localStorage)
alert("Error: localstorage not usable");
var db = window.openDatabase("Database", "1.0", "DatabaseName", 200000);
您知道它从何而来以及我该如何解决它吗?提前致谢。
亲切的问候, 六。
最佳答案
根据 http://androidforums.com/application-development/103644-why-doesnt-work-javascript-opendatabase-android.html , Android 从一开始就对 window.OpenDatabase()
方法有不确定的支持。您可能希望查看此 StackOverflow 线程:Android 4.0.1 breaks WebView HTML 5 local storage?
关于javascript - Android 4.0.3,window.openDatabase 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12076356/