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.