小编oma*_*h94的帖子

如何修复chrome-extension内联JavaScript调用错误?

我正在进行chrome扩展,但是当我尝试启动onclick()事件时,我似乎遇到以下错误.

Refused to load the script 'https://apis.google.com/js/client.js?onload=handleClientLoad' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:"
Run Code Online (Sandbox Code Playgroud)

Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
Run Code Online (Sandbox Code Playgroud)

这是我的manifest.json:

{
  "manifest_version": 2,

  "name": "SECURE",
  "description": "this extension offers secure communication for GMAIL     users",
  "version": "1.0",

 "browser_action": {
 "default_icon": "resources/icon16.png", …
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome google-chrome-extension content-security-policy

25
推荐指数
1
解决办法
3万
查看次数