相关文章推荐
谦虚好学的太阳  ·  【新书连载】一波三折:释放内存导致数据库崩溃 ...·  2 年前    · 
欢乐的莲藕  ·  attempt包测试2_Try_Catch_ ...·  2 年前    · 
寂寞的杯子  ·  AndroidStudio提示磁盘空间不足_ ...·  2 年前    · 
私奔的硬盘  ·  https - Nexus Docker ...·  2 年前    · 
稳重的皮带  ·  HTML5音频标签在安卓系统的react-n ...·  2 年前    · 
Code  ›  如何修复chrome-extension内联JavaScript调用错误?开发者社区
https://cloud.tencent.com/developer/ask/sof/34668
英俊的羊肉串
2 年前
首页
学习
活动
专区
工具
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'"
 
推荐文章
谦虚好学的太阳  ·  【新书连载】一波三折:释放内存导致数据库崩溃-腾讯云开发者社区-腾讯云
2 年前
欢乐的莲藕  ·  attempt包测试2_Try_Catch_2020-02-03_数学函数中用了非数值参数_知无牙的博客-CSDN博客
2 年前
寂寞的杯子  ·  AndroidStudio提示磁盘空间不足_studio one5安装显示内存不足_shrimpcolo的博客-CSDN博客
2 年前
私奔的硬盘  ·  https - Nexus Docker Registry - Failling anonymous pull - Stack Overflow
2 年前
稳重的皮带  ·  HTML5音频标签在安卓系统的react-native-webview上不工作,但在IOS上可以工作
2 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
Code - 代码工具平台
© 2024 ~ 沪ICP备11025650号