undefined indexedDB on Windows Phone 8.1 javascript app

北城以北 提交于 2019-12-20 02:50:51

问题


I have the following code on a (HTML/javascript) Windows Store app

var reqOpen = window.indexedDB.open(that.dbName, that.dbVersion);

The thing is, when I wanted to use that exact code on a (HTML/javascript) Windows Phone 8.1 app I get undefined on window.indexedDB.

I can't seem to find any samples or anything related to indexedDB on WinPhone. The only article that I found that mentions both Windows Store and Windows Phone apps is this one, but it is not clear if there's a difference for either 'platform'

Am I missing something?


回答1:


IndexedDB is not available on Windows Phone 8.1 HTML store apps.

I wrote a SQLite for Windows Apps blog post which mentions this and describes how you might work around it: wrap up SQLite in WinRT and use that instead.

The blog post is mostly about creating your own but it also links to some existing projects that do this and that might have acceptable licenses for you, including SQLite-WinRT.

SQLite isn't necessarily your only option, but it is the only one I know of that is popular, has written VS extensions, and is actively supporting running in Windows store apps.




回答2:


Have you tried using the prefixed global described here? Something like the following preceding the call to window.indexedDB.open: window.indexedDB = window.indexedDB || window.msIndexedDB;.



来源:https://stackoverflow.com/questions/25307897/undefined-indexeddb-on-windows-phone-8-1-javascript-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!