gpt4 book ai didi

firebase-cloud-messaging - 指令 "https://www.gstatic.com/"中的浏览器扩展不安全 CSP 值 'script-src'

转载 作者:行者123 更新时间:2023-12-05 03:34:04 32 4
gpt4 key购买 nike

我正在尝试将 Firebase 云消息传递集成到我的 chrome 扩展程序中,但它抛出了错误

content_security_policy.extension_pages': Insecure CSP value "https://www.gstatic.com/" in directive 'script-src'.Could not load manifest.

extension error

下面是 list json 文件,我使用 list 版本 3:

{
"name": "Getting Started Example",
"description": "Build an Extension!",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"permissions": ["storage", "activeTab", "scripting"],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
}
},
"icons": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"css": ["my-styles.css"],
"js": ["content-script.js"]

}
],
"content_security_policy":{ "extension_pages": "script-src 'self' https://www.gstatic.com/ https://*.firebaseio.com https://www.googleapis.com; object-src 'self'; connect-src 'self' wss://*.firebaseio.com;" },
"web_accessible_resources": [
{
"resources": [

],
"matches": [
"<all_urls>"
]
}

]


}

如何将 firebase 云消息传递集成到我的扩展程序中?

最佳答案

将 firebase 库下载到扩展中并导入为本地文件。不是一个完美的解决方案,而是一个可行的方法:

<html>
<head>
<meta charset="utf-8"/>
<script src="firebase-compat-9-6-0.js"></script>
...
</head>
<body>
...
</body>
</html>

关于firebase-cloud-messaging - 指令 "https://www.gstatic.com/"中的浏览器扩展不安全 CSP 值 'script-src',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70225470/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com