1

我创建了一个 Chrome 扩展,其中包含两个 html 页面background.htmlhelper.html.

我正在尝试将代码注入helper.html当然在扩展内运行的代码中。作为我用 chrome 创建的窗口helper.html运行。. 但是,到目前为止,我无法这样做。从文档中我了解到我的内容脚本规则应该是popupwindows.create(object createData, function callback)

   "content_scripts": [
        {
          "matches": ["chrome-extension://*/*"],
          "js": ["jquery.js","myscript.js"],
           "css": ["style.css"],
          "run_at": "document_end"
        }

但它失败了。

请注意,当我改用 localhost 时,例如

"content_scripts": [
    {
      "matches": ["http://localhost/"],
      "js": ["jquery.js","myscript.js"],
      "css": ["style.css"],
      "run_at": "document_end"
    }

有用。本地主机运行完全相同的代码,但不知何故,扩展程序拒绝识别我试图匹配的文件("matches": ["chrome-extension://*/*"]

4

1 回答 1

0

Chrome 扩展程序无法将内容脚本注入 Chrome 扩展程序。

您将希望改用消息传递

于 2013-07-31T20:38:08.043 回答