admin管理员组文章数量:1430756
In my Google Chrome Extension I need to be able to inject my content script into all IFRAME
s on the page. To do this my original manifest.json
was declared as such:
"content_scripts": [
{
"run_at": "document_end",
"all_frames" : true,
"matches": ["http://*/*", "https://*/*"],
"js": ["content.js"]
}
],
This seemed to have worked for most sites, until I came across an IFRAME
that was declared as such:
(From Chrome debugger)
and here's the HTML for it:
<iframe id="wysiwygtext_ifr" src='javascript:""' frameborder="0" allowtransparency="true" title="Rich Text Area." style="width: 100%; height: 341px; display: block;"></iframe>
In this case my content script is not injected into that IFRAME
.
I tried changing the matches
filter to "matches": ["<all_urls>"]
but that still didn't do it.
Is there any way for me to inject my content script in an IFRAME
like that?
In my Google Chrome Extension I need to be able to inject my content script into all IFRAME
s on the page. To do this my original manifest.json
was declared as such:
"content_scripts": [
{
"run_at": "document_end",
"all_frames" : true,
"matches": ["http://*/*", "https://*/*"],
"js": ["content.js"]
}
],
This seemed to have worked for most sites, until I came across an IFRAME
that was declared as such:
(From Chrome debugger)
and here's the HTML for it:
<iframe id="wysiwygtext_ifr" src='javascript:""' frameborder="0" allowtransparency="true" title="Rich Text Area." style="width: 100%; height: 341px; display: block;"></iframe>
In this case my content script is not injected into that IFRAME
.
I tried changing the matches
filter to "matches": ["<all_urls>"]
but that still didn't do it.
Is there any way for me to inject my content script in an IFRAME
like that?
1 Answer
Reset to default 7This is exactly the problem that the match_about_blank
flag was created for. It was finally released to stable in Chrome 37.
Just add "match_about_blank": true
to the content script definition.
You can also use it in tabs.executeScript. See:
- https://developer.chrome./extensions/content_scripts
- https://developer.chrome./extensions/tabs#type-InjectDetails
本文标签: javascriptCan39t inject content script into all IFRAMEs from my Chrome ExtensionStack Overflow
版权声明:本文标题:javascript - Can't inject content script into all IFRAMEs from my Chrome Extension - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745429492a2658262.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论