【发布时间】:2018-05-29 12:55:50
【问题描述】:
我正在尝试在我的项目中实现 firestore。 我现在正在做的只是实现它并读取一些数据,但我得到标题中的错误:
由于访问控制检查,XMLHttpRequest 无法加载 https://firestore.googleapis.com/google.firestore.....。
我使用以下内容:
// Initialize Firebase
var config = {
apiKey: "xxx",
authDomain: "xxx",
databaseURL: "xxx",
projectId: "xxx",
storageBucket: "xxx",
messagingSenderId: "xxx"
};
firebase.initializeApp(config);
// Initialize Cloud Firestore through Firebase
var db = firebase.firestore();
var docRef = db.collection("users");
docRef.get().then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
//alert(doc.data().born);
});
})
.catch(function(error) {
console.log("Error getting documents: ", error);
});
我尝试检索数据的部分导致错误 (docRef.get()...)
您知道为什么会发生此错误吗?
提前致谢,
【问题讨论】:
-
这有什么好运气吗?我遇到了同样的问题...
-
这里也一样,但我只是在 safari 中看到这个错误...顺便说一下,我看到了错误,但我能够读取数据
标签: javascript firebase google-cloud-firestore