相关文章推荐
魁梧的白开水  ·  海鸥体育app官网入口权威上线,官方入口三处 ...·  1 月前    · 
健身的杨桃  ·  冰岛前总统格里姆松走进苏世民书院课堂-清华大 ...·  2 年前    · 
逆袭的莴苣  ·  十月ht合集·  2 年前    · 
高大的春卷  ·  中铁1到25局局长最新履历!_腾讯新闻·  3 年前    · 
憨厚的大熊猫  ·  云南退休干部招募敢死队,命名中国班加西工程, ...·  3 年前    · 
Code  ›  如何修复chrome-extension内联JavaScript调用错误?开发者社区
https://cloud.tencent.com/developer/ask/sof/34668
英俊的羊肉串
3 年前
首页
学习
活动
专区
工具
TVP
返回腾讯云官网
提问
问 如何修复chrome-extension内联JavaScript调用错误?
Stack Overflow用户
提问于 2016-04-14 19:49:03
EN

我正在做一个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:"

和

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.

这是我的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",
 "default_popup": "popup.html",
 "default_title": "Click here!"
 "background":{
   "scripts":["background.js"]
 "content_scripts": [
   "matches": ["http://*/*", "https://*/*"],
   "js":["myscript.js"],
   "run_at": "document_end"
"permissions": ["identity", "https://accounts.google.com/*",  "https://www.googleapis.com/*"],
"oauth2": {
   "client_id": "975410329966.apps.googleusercontent.com",
 "scopes": [
   "<all urls>",
   "https://www.googleapis.com/auth/drive",
   "https://mail.google.com/",
   "https://www.googleapis.com/auth/gmail.login",
   "https://www.googleapis.com/auth/gmail.compose",
   "https://www.googleapis.com/auth/gmail.readonly",
   "https://www.googleapis.com/auth/gmail.send"
 "content_security_policy":"script-src 'self'  'unsafe-inline' 'unsafe eval'  https://apis.google.com/js/client.js?; object-src 'self'"
 
推荐文章
魁梧的白开水  ·  海鸥体育app官网入口权威上线,官方入口三处核验:登录与找回密码指引、防钓鱼识别、帮助中心自助排查-中关村在线
1 月前
健身的杨桃  ·  冰岛前总统格里姆松走进苏世民书院课堂-清华大学苏世民书院
2 年前
逆袭的莴苣  ·  十月ht合集
2 年前
高大的春卷  ·  中铁1到25局局长最新履历!_腾讯新闻
3 年前
憨厚的大熊猫  ·  云南退休干部招募敢死队,命名中国班加西工程,妄图颠覆国家政权-西瓜视频
3 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
Code - 代码工具平台
© 2024 ~ 沪ICP备11025650号