违反 Chrome 扩展程序上的内容安全策略指令

问题描述

我们正在尝试将脚本 src='https://apis.google.com/js/platform.js' 加载到我们的 Chrome 扩展程序中,以便访问 gapi (Google Api)。但是,每当我们的 html 文件中有 <script src='https://apis.google.com/js/platform.js'></script> 时,我们都会反复收到此错误

Refused to load the script 'https://apis.google.com/js/platform.js' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem:". Note that 'script-src-elem' was not explicitly set,so 'script-src' is used as a fallback."

我们已经尝试了 this StackOverflow Post 中的几种解决方案,但似乎都没有奏效。我们只是尝试访问 gapi 库以搜索 YouTube 视频。

编辑:这是我们的 mainfest.json。 “https://apis.google.com/js/”包含我们试图包含的 gapi。

{
  "manifest_version": 2,"name": "Extension","version": "0.1.0","description": "Extension description","browser_action": {
    "default_popup": "popup.html","default_icon": {
        "16": "images/icon16.png","24": "images/icon24.png","32": "images/icon32.png"
    }
  },"content_scripts": [{
      "js": ["popup.js"],"matches": ["https://apis.google.com/js/"]
    }]
}

关于为什么会这样的任何想法?感谢您的帮助!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)