Accessing iframes from a Chrome content-script extension

前端 未结 2 1124
谎友^
谎友^ 2020-12-28 08:43

I\'m writing a Chrome extension that needs to alter a popular web app when loaded. Unfortunately, most of the UI of that web app is rendered inside an iframe, and although t

2条回答
  •  隐瞒了意图╮
    2020-12-28 09:01

    Even "all_frames": true doesn't seem to help in the case of iframes without @src. This is discussed in the bug http://code.google.com/p/chromium/issues/detail?id=20773, which also covers some workarounds, including getting the contentDocument of the iframe element in the source page, e.g. $('a', $($("#canvas_frame")[0].contentDocument)).

    This bug is not exactly the problem you were having (you wanted to load your content script inside the iframe, not interact between the iframe and the outer frame) but I think that most people who have one of the problems will have the other one as well.

提交回复
热议问题