Reputation: 22327
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?
Upvotes: 3
Views: 3143
Reputation: 614
This 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:
Upvotes: 7