Is it possible for me to setup an iframe so it calls a javascript function available in the window.parent.document
scope?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
If I am understanding the question correctly, assuming functionName()
is defined within the parent of iframe, you can do this within your iframe:
window.parent.functionName();
This will only work though, if both parent and iframe are on the same domain: http://softwareas.com/cross-domain-communication-with-iframes