How to get a reference of the content window of the parent window from an iframe, when the parent is cross domain
I need to so 开发者_Python百科that the iframe can send a postMessage to it.
@Millebi you can do this using following work around.
<iframe id="frmInner" src="http://www.yahoo.com" height="200" width="200" onload="javascript:$.getScript('Scripts/crossdomain.js',function(){ SomeFunction("someparam"); });">
</iframe>
Where frminner is the frame that displays yahoo page in your site and when loaded completely it calls for a javascript file in you domain i-e crossdomain.js , the JS file has SomeFunction() already defined in it which is called with parameter "someparam". Hope this is what you want.
Because of same origin policy, you have no means to know what is happening is the X-domain child frame. Vice-Versa you have no means to send information up.
However if the other domain is friend of yours, you can establish a communication via the cookies. see also on SO
精彩评论