Is it possible to use Firebase with a Windows 8 app?

好久不见. 提交于 2019-12-22 10:29:56

问题


I'm hoping to use Firebase in my Windows 8 app made using WinJS. Here is how I am trying to write to the root of my Firebase:

var dataRef = new Firebase("https://<firbaseName>.firebaseio.com");
dataRef.set("I am now writing data into Firebase!");

However, this gives me the following error in the JavaScript console:

Can’t load <https://<firebaseName>.firebaseio.com/.lp?start=t&ser=66595697&cb=2&v=5>. An app can’t load remote web content in the local context.

I've tried to add https://[firebaseName].firebaseio.com/* to my Content URIs in my app manifest but that doesn't seem to be the solution. Does anyone know if it's possible to get Firebase working inside of a Windows 8 app?


回答1:


You should be able to use firebase.js natively in a Windows 8 (WinJS) app. Just download a copy, and embed it with your app. If you run into any issues, please email support@firebase.com.




回答2:


I wanted to add that is not possible to use the regular firebase.js file alone. (5/5/15 and firebase.js 2.2.4)

The issue is firebase by default tries to do long polling and calls a script from firebase which violates CSP.

Firebase.js has a function called isWindowsStoreApp() but in my tests it doesn't work.

What @Michael Lehenbauer said in an earlier comment triggers it to only use websockets which is local and CSP safe.. Just call

Firebase.INTERNAL.forceWebSockets();

early and it works...



来源:https://stackoverflow.com/questions/19828632/is-it-possible-to-use-firebase-with-a-windows-8-app

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