Javascript 如何在Chrome扩展内容脚本中使用Firebase
我正在开发一个Chrome扩展,我想将Firebase Firestore加载到我的内容脚本中。我看过stack overflow:但是为了我一生的爱,我不能让它工作。我知道它要求我下载Firebase JDK并将其包含在扩展中,但我无法正确加载它。我总是得到错误未定义firebase 这是我的法斯特:Javascript 如何在Chrome扩展内容脚本中使用Firebase,javascript,firebase,google-chrome-extension,google-cloud-firestore,Javascript,Firebase,Google Chrome Extension,Google Cloud Firestore,我正在开发一个Chrome扩展,我想将Firebase Firestore加载到我的内容脚本中。我看过stack overflow:但是为了我一生的爱,我不能让它工作。我知道它要求我下载Firebase JDK并将其包含在扩展中,但我无法正确加载它。我总是得到错误未定义firebase 这是我的法斯特: "content_scripts":[ { "matches": [ "<all_urls>" ], "js": [
"content_scripts":[
{
"matches": [
"<all_urls>"
],
"js": [
"content.js"
]
}
],
"background": {
"page": "background.html"
},
"browser_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/tiny.png",
"32": "images/log32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
},
"icons": {
"16": "images/tiny.png",
"32": "images/log32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
},
"manifest_version": 2,
"content_security_policy":"script-src 'self' https://www.gstatic.com/ https://*.firebaseio.com https://www.googleapis.com https://apis.google.com/; object-src 'self'"
}
“内容脚本”:[
{
“匹配项”:[
""
],
“js”:[
“content.js”
]
}
],
“背景”:{
“页面”:“background.html”
},
“浏览器操作”:{
“默认弹出窗口”:“popup.html”,
“默认_图标”:{
“16”:“images/tiny.png”,
“32”:“images/log32.png”,
“48”:“images/get_started48.png”,
“128”:“images/get_started128.png”
}
},
“图标”:{
“16”:“images/tiny.png”,
“32”:“images/log32.png”,
“48”:“images/get_started48.png”,
“128”:“images/get_started128.png”
},
“清单版本”:2,
“内容安全策略”:“脚本src'self”https://www.gstatic.com/ https://*.firebaseio.comhttps://www.googleapis.com https://apis.google.com/;对象src“self”
}
感谢您的帮助。内容脚本无法在现代Chrome中进行跨源网络请求,因此我认为在那里使用Firebase是没有意义的。