execute javascript function in a another iframe when parent is from different domain.
Posted
by Frushko
on Stack Overflow
See other posts from Stack Overflow
or by Frushko
Published on 2010-06-13T15:30:41Z
Indexed on
2010/06/13
15:32 UTC
Read the original article
Hit count: 227
The page A.com has 2 iframes B.com/page1 and B.com/page2. This is the code of A.com:
<html><body>
<iframe src="b.com/page1" name="iframe1" id="iframe1">
<iframe src="b.com/page2">
</body></html>
I want to execute js function on B.com/page1 from B.com/page2. Both examples below works well when the parent is from the same domain but not in cross domain scenario:
parent.window.frames['iframe1'].SomeFunction(args);
or
parent.document.getElementById('iframe1').contentWindow.SomeFunction(args);
Is there any way to do it?
© Stack Overflow or respective owner