c00*_*0fd 2 javascript iframe google-chrome google-chrome-extension content-script
在我的Google Chrome扩展程序中,我需要能够将我的内容脚本注入IFRAME
页面上的所有内容.要做到这一点,我的原件manifest.json
被声明为:
"content_scripts": [
{
"run_at": "document_end",
"all_frames" : true,
"matches": ["http://*/*", "https://*/*"],
"js": ["content.js"]
}
],
Run Code Online (Sandbox Code Playgroud)
这似乎适用于大多数网站,直到我遇到一个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>
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我的内容脚本不会注入其中IFRAME
.
我尝试更改matches
过滤器,"matches": ["<all_urls>"]
但仍然没有这样做.
有没有办法为我注入我的内容脚本中的IFRAME
那样?
这正是match_about_blank
为其创建标志的问题.它最终在Chrome 37中稳定发布.
只需添加"match_about_blank": true
内容脚本定义即可.
您也可以在tabs.executeScript中使用它.看到:
归档时间: |
|
查看次数: |
2473 次 |
最近记录: |