Can I access the content of an iframe in JavaScript that is part of a Google Chrome extension?

一曲冷凌霜 提交于 2019-12-25 06:52:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!