Is it possible for me to setup an iframe so it calls a javascript function available in the window.parent.document scope?
1 Answer
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
2 Comments
Nate
IMPORTANT: be sure to check out the more modern approach referenced/updated in the above URL (window.postMessage). It has pretty good support.
juanram0n
And a plus on the @Nate answer is that postMessage method is for cross-origin comunicacion. Direct "functionName" not works in cross-origin context.