admin 管理员组文章数量: 1086019
Here are two cases: Uppercase as one domain while lowercase as another 1.Suppose window A holds iframe b, and b holds iframe C, A & C in one domain(higher privacy) while b in another. Is there any direct way for munication between A & C, oneway or twoway. 2.Suppose A holds iframe b and iframe c, A is in one domain while B & C in other, just the same question as outlined in the first case.
I will really appreciate your answer, it will be better if with some javascript codes Thanks
Here are two cases: Uppercase as one domain while lowercase as another 1.Suppose window A holds iframe b, and b holds iframe C, A & C in one domain(higher privacy) while b in another. Is there any direct way for munication between A & C, oneway or twoway. 2.Suppose A holds iframe b and iframe c, A is in one domain while B & C in other, just the same question as outlined in the first case.
I will really appreciate your answer, it will be better if with some javascript codes Thanks
Share Improve this question asked Jul 17, 2009 at 9:18 abusemindabusemind 2132 gold badges5 silver badges16 bronze badges2 Answers
Reset to default 7Yes if they are deliberately cooperating. HTML5 includes the postMessage API for this purpose, and it's implemented in IE8, FF3.5, Chrome, Opera, etc. For downlevel browsers, a "hack" called Fragment Messaging can be used. If you use Flash, you can use Flash Local munication channels.
No. Client side munication between frames on different domains is not possible due to the same origin policy.
If it was possible, you could do things like loading a bank website into a frame which fills the entire window, and polling it to see if the user has typed anything in the username and password fields.
If you want to municate between domains, then there are two approaches. You need to make an HTTP request to achieve either of them.
- Pass the information in the URL when loading the page
- For information loaded using a
<script>
element, any code in the loaded JS file from the remote domain will run in the page with the<script>
element in it.
You can bine the two approaches:
<script
type="text/javascript"
src="http://example./script.cgi?data=foo;more_data=bar">
</script>
See JSON-P.
本文标签: javascriptNested iframe crossdomain communicationStack Overflow
版权声明:本文标题:javascript - Nested iframe cross-domain communication - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1743997542a2515852.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论