execute javascript function in a another iframe when parent is from different domain.
- by Frushko
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?