我正在尝试我的Firebase测试版邀请,从我创建的本地HTML调用db。这是拒绝工作的代码。
<html>
<head>
<script src="https://static.firebase.com/v0/firebase.js"></script>
<script type="text/javascript">
var myDataReference;
function call_on_click() {
alert("Done!");
try {
myDataReference = new Firebase('https://sbose78.firebaseio.com/');
myDataReference.set('I am now writing data into Firebase!');
} catch (e) {
}
}
</script>
</head>
<body>
<input type="button" value="push me" onclick="call_on_click()">
</body>
</html>我在Ubuntu上使用Firefox 11。
[02:40:58.766] Firebase is not defined @ file:///root/Desktop/firebase-app1.html:20
--
[02:43:28.743] file:///root/Desktop/firebase-app1.html
[02:43:28.796] GET https://static.firebase.com/v0/firebase.js [HTTP/1.1 200 OK 1766ms]
[02:43:30.572] uncaught exception: [Exception... "Operation is not supported" code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location: "https://static.firebase.com/v0/firebase.js Line: 28"]我遗漏了什么?
提前感谢!
发布于 2012-11-07 08:29:41
这是Firebase JavaScript客户端中的一个错误,是由从文件加载内容时在Firefox中处理sessionStorage引起的。它应该在这一点上被修复。
再试一次,它就会起作用。
发布于 2012-11-04 06:53:26
据我所知,这是same origin policy的问题。如前述文件所述:
从Gecko 1.9开始,文件只允许读取某些其他文件。具体地说,仅当原始文件的父目录是目标文件的祖先目录时,文件才能读取另一个文件。但是,不能以这种方式加载目录。
例如,如果您有一个访问另一个文件bar.html的文件foo.html,并且您已从文件index.html导航到该文件,则仅当bar.html位于与index.html相同的目录中,或者位于与index.html相同的目录中时,加载才会成功。
https://stackoverflow.com/questions/13213690
复制相似问题