【发布时间】:2013-04-05 14:24:32
【问题描述】:
在 chrome 扩展的清单文件中指定参数时,有一个选项 all_frames。这允许内容脚本嵌入或不嵌入页面的所有框架中。
我想要实现的一个示例是使用 all_frames=false 运行 a.js,使用 all_frames=true 运行 b.js。
【问题讨论】:
标签: javascript iframe google-chrome-extension manifest frames
在 chrome 扩展的清单文件中指定参数时,有一个选项 all_frames。这允许内容脚本嵌入或不嵌入页面的所有框架中。
我想要实现的一个示例是使用 all_frames=false 运行 a.js,使用 all_frames=true 运行 b.js。
【问题讨论】:
标签: javascript iframe google-chrome-extension manifest frames
content_scripts 清单属性是一个数组,因此您可以定义多个内容脚本规范对象:
"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
}
],
【讨论】: