简体   繁体   English

Chrome扩展程序:iframe与弹出窗口之间的通信

[英]Chrome Extension: communication between iframe and popup

I'm developing a Chrome extension, Which presents the user with an iFrame once the popup window is shown. 我正在开发一个Chrome扩展程序,该扩展程序会在显示弹出窗口后为用户提供一个iFrame。 I wish to invoke javascript function back on the hosting page. 我希望在托管页面上调用javascript函数。 Now while I can access the "parent" object (it is not null) I can not invoke any method (like you would do with standard webpage that hosts an iFrame). 现在,尽管我可以访问“父”对象(它不是null),但是我不能调用任何方法(就像您对承载iFrame的标准网页所做的那样)。

Any ideas how to accomplish this? 任何想法如何做到这一点?

Thanks, E. 谢谢,E。

If the iFrame is an extension page, then you can use chrome.extension.getViews http://code.google.com/chrome/extensions/extension.html#method-getViews 如果iFrame是扩展页面,则可以使用chrome.extension.getViews http://code.google.com/chrome/extensions/extension.html#method-getViews

That will get the list of views for that extension, and can manipulate it that way. 这将获取该扩展的视图列表,并可以通过这种方式进行操作。

您可以使用opener属性访问创建弹出窗口的窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM