google-chrome-extension - 将外部 api 与 Web 扩展清单 v3 一起使用
问题描述
我正在创建一个网络扩展,我需要在其中使用 google recaptcha。但是当我尝试导入库时出现错误
Refused to load the script 'https://www.google.com/recaptcha/api.js?onload=onloadcallback&render=explicit' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
我试图将我的脚本 src 设置为授权对https://www.google.com的请求
"content_security_policy": {
"extension_pages": "script-src 'self' 'https://www.google.com'; object-src 'self'"
},
但我有一个错误
'content_security_policy.extension_pages': Insecure CSP value "'https://www.google.com'" in directive 'script-src'.
仍然可以将外部脚本与 manifest v3 一起使用,如果可以,我应该怎么做?
解决方案
推荐阅读
- javascript - 使用 Sinon 和 Promises 存根函数
- php - 如何在 WordPress 中将图片上传到数据库并通过上传/提交按钮安全存储?
- python-3.x - 将 textvariable 分配给 entry 会导致在 DoubleVar 上禁用验证
- angularjs - 如何在 AngularJS 中使用 GET API 以及如何检查 API Key Value 是否等于 HTML 中任何表格内容行中的数据值?
- react-native - 3页之间的反应导航
- mysql - 重复表字段与仅索引
- c# - 有没有办法通过 touchInput 按钮在 Unity 中保持跳远?
- ruby-on-rails - Ruby on Rails:登录的 gem 设计会话
- vue.js - Datepicker 在输入时未得到验证
- aem - 如何将属性添加到在运行时创建的标签