Google chrome extension [CRX]:没有';不允许扩展名中包含我的js文件

Google chrome extension [CRX]:没有';不允许扩展名中包含我的js文件,google-chrome-extension,google-chrome-devtools,Google Chrome Extension,Google Chrome Devtools,这是我的申请代码: manifest.json文件: { "name": "YouTradeFx Debugger", "version": "1.0", "manifest_version": 2, "description": "This appliction allow YoutradeFX R&D team to debugging thier applications, by using few tools", "browser_action": { "defa

这是我的申请代码:

manifest.json文件:

{
 "name": "YouTradeFx Debugger",
 "version": "1.0",
 "manifest_version": 2,
 "description": "This appliction allow YoutradeFX R&D team to debugging thier applications, by using few tools",
 "browser_action": {
   "default_popup": "app.html"
 }
}
app.html文件:

<html>
<head>
 <title>Source of the application</title>
 <script src="jquery.js"></script>
 <script src="app.js"></script>
</head>
<body style="width: 350px;">
  <span style="display: none;">
   <button id="Http">Send Requests</button>
    <button id="Cookie">Add Lead Params</button>
    <button id="Crm">CRM Faliure</button>
</span>
 <div id="Content">
 <table id="cons">
  <tr>
   <td>Please your username:</td>
   <td><input type="text" id="names" name="user"></td>
  </tr>
  <tr>
  <td><input type="submit" name="send" value="SEND"></td>
 </tr>
 </table>
</div>
</body>
</html>
但我收到了错误消息“拒绝执行内联脚本,因为它违反了以下内容安全策略指令:“script src'self'chrome extension resource:”。一直如此

为什么不工作?我做错了什么?

您正在从
https://www.mywebsite.com/ChromeExt/crm_buffer.php?uid=“+HoldUser
,然后将其注入您的
app.html
页面。当注入html时,它将被解析,并包含所有提到的资源(
等)。”开始加载。由于您可能有一些JavaScript文件,并且默认的Chrome扩展策略不允许扩展从远程位置运行脚本,因此会出现安全冲突错误


您可以通过使网站的响应更像API调用,返回JSON或文本而不是HTML来解决此问题。如果
mywebsite.com
不是您的,或者您不想在那里更改任何内容,您可以将它加载的脚本列为白名单,或者解析
$中返回的
数据
变量。获取
并删除所有
等重新注入它。

您将获得页面https://www.mywebsite.com/ChromeExt/crm_buffer.php?uid=“+HoldUser因此,您可以在该页面上执行单击、鼠标按下等事件。另外,我在manifest.json上看不到任何权限。这也可能会阻止请求。您可以通过将下面的行添加到manifest.json中来轻松测试这一点。如果这不起作用,请查看mywebsite.com,看看它是否坏了

"permissions": [
    "http://*/*",
    "https://*/*",
],

错误消息非常明显:您正在某处使用内联代码。app.js或crm_buffer.php是否包含任何内联代码?例如
onclick=“foo();”
…code…
?不,它只包含一个应该返回的字符串“hello world”。。。
"permissions": [
    "http://*/*",
    "https://*/*",
],