gpt4 book ai didi

node.js - google chrome 扩展中远程 Node 服务器上的 socket.io

转载 作者:太空宇宙 更新时间:2023-11-04 01:14:03 25 4
gpt4 key购买 nike

我正在开发一个 chrome 扩展,我正在尝试通过 socket.io (在我的后台脚本中)连接到我的 Node 服务器,但我无法在我的服务器上加载 socket.io.js...我得到一个:

Refused to load the script 'http://myhost:8080/socket.io/socket.io.js' because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:".

所以我开始在网上搜索,但我有点卡住了。有可能做这样的事吗?如果没有,我如何与我的服务器通信?请提供任何帮助,非常感谢:)

最佳答案

是的,这是可能的。您只需要在manifest.json 中指定一些指令:

"content_security_policy": "default-src 'none'; script-src 'self'"

关于node.js - google chrome 扩展中远程 Node 服务器上的 socket.io,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12913594/

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