是否可以将Firebase与Windows 8应用程序一起使用?

时间:2013-11-07 05:30:47

标签: windows-8 winjs firebase windows-8.1

我希望在使用WinJS制作的Windows 8应用中使用Firebase。以下是我尝试写入Firebase的根目录的方法:

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

但是,这会在JavaScript控制台中出现以下错误:

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.

我尝试将https:// [firebaseName] .firebaseio.com / *添加到我的应用清单中的内容URI中,但这似乎不是解决方案。有谁知道是否可以让Firebase在Windows 8应用程序内运行?

2 个答案:

答案 0 :(得分:1)

您应该能够在Windows 8(WinJS)应用程序中本机使用firebase.js。只需下载副本,并将其嵌入您的应用程序。如果您遇到任何问题,请发送电子邮件至support@firebase.com。

答案 1 :(得分:-1)

我想补充说,单独使用常规firebase.js文件是不可能的。 (5/5/15和firebase.js 2.2.4)

问题是firebase默认尝试执行long polling并从firebase调用违反CSP的脚本。

Firebase.js has a function调用isWindowsStoreApp(),但在我的测试中它不起作用。

@Michael Lehenbauer在之前的评论中说过,它只使用本地和CSP安全的websockets ..只需调用

Firebase.INTERNAL.forceWebSockets();

早,它有效......