javascript - 无法为内容脚本加载 JavaScript 'content_script.js'

标签 javascript json google-chrome manifest

我有一个简单的 manifest.json,但出于某种原因,我一直遇到这个错误

无法为内容脚本加载 JavaScript“content_script.js”

一旦我添加 content_scripts。知道我做错了什么吗?

{
    "manifest_version": 2,
    "version": "0.0.1",
    "name": "My Extension",
    "description": "A plain text description",
    "content_scripts": [
      {
        "matches": ["https://messenger.com/*"],
        "js": ["content_script.js"]
      }
    ],
    "options_page": "options.html",
    "options_ui": {
      "chrome_style": true,
      "page": "options.html"
    },
    "permissions": [
      "tabs",
      "activeTab"
    ]
}

最佳答案

我只是有一个类似的错误,当在 Chrome 中加载解压的扩展时,我必须选择包含 manifest.json 和 content_script.js 的 SOURCE 目录

如果我选择从 GitHub 下载的整个扩展目录,我会遇到与您遇到的相同的错误。

关于javascript - 无法为内容脚本加载 JavaScript 'content_script.js',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50564910/

相关文章:

javascript - Bootstrap 工具提示右移

javascript - jQuery 如何在闭包范围之外可用?

javascript - 选择框未显示在分词器中

javascript - 无法在对象方法中的箭头函数上绑定(bind)上下文

python - django-storages dropbox.stone_validators.ValidationError

python - Selenium Webdriver (ChromeDriver) - 给出未知错误 : Runtime.executionContextCreated 具有无效的“上下文错误”

javascript - 在 CRM 2011 中使用 OData 检索多个

javascript - 由 Json 填充的组合框

google-chrome - 在 OWN 浏览器中禁用刷新/后退/前进

html - Chrome 扩展 HTML 文件系统访问