【发布时间】:2014-11-03 13:42:04
【问题描述】:
在我的 Google Chrome 扩展程序中,我需要能够将我的 内容脚本 注入页面上的所有 IFRAMEs。为此,我原来的 manifest.json 声明如下:
"content_scripts": [
{
"run_at": "document_end",
"all_frames" : true,
"matches": ["http://*/*", "https://*/*"],
"js": ["content.js"]
}
],
这似乎对大多数网站都有效,直到我遇到了这样声明的IFRAME:
(来自 Chrome 调试器)
这是它的 HTML:
<iframe id="wysiwygtext_ifr" src='javascript:""' frameborder="0" allowtransparency="true" title="Rich Text Area." style="width: 100%; height: 341px; display: block;"></iframe>
在这种情况下,我的内容脚本不会注入到 IFRAME。
我尝试将matches 过滤器更改为"matches": ["<all_urls>"],但还是不行。
我有什么方法可以将我的 内容脚本 注入到这样的 IFRAME 中吗?
【问题讨论】:
标签: javascript google-chrome iframe google-chrome-extension content-script