问题
I have an iframe within the main window named "test_iframe". I want to access the content of "test_iframe" within a Google Chrome extension. I understand that I can do this if I have requisite permissions given in manifest.json
.
Can I access the content of this iframe from a background HTML page? Or can I access it in a content script which is part of that extension? (In the latter case I suppose I have to pass the iframe content from the content script to a background page as part of a message for further processing(?))
回答1:
Let's say this test_iframe
comes from http://frame.example.com
. I would just inject a content script directly to frame.example.com
(instead of the parent page) and do everything there.
来源:https://stackoverflow.com/questions/7331959/can-i-access-the-content-of-an-iframe-in-javascript-that-is-part-of-a-google-chr