1

在 chrome 扩展的清单文件中指定参数时,有一个选项all_frames. 这允许内容脚本嵌入或不嵌入页面的所有框架中。

我想要实现的一个例子是让 a.js 使用all_frames=false运行, b.js 使用all_frames=true.

4

1 回答 1

3

content_scriptsmanifest 属性是一个数组,因此您可以定义多个内容脚本规范对象:

"content_scripts": [
    {
      "matches": ["http://www.google.com/*"],
      "css": ["mystyles.css"],
      "js": ["a.js"],
      "all_frames": false
    },

    {
      "matches": ["http://www.yahoo.com/*"],
      "js": ["b.js"],
      "all_frames": true
    }
],
于 2013-04-05T14:40:29.640 回答