HTML and CSS Reference
Appendix F. Channel messaging
Channel messaging is similar to cross-document messaging (see chapter4 ) except instead of
one message channel per window, it allows multiple channels to be created. This is useful
if you want to build the page out of a number of loosely coupled, event-driven, independent
components. Rather than adapt them all to share a single cross-document messaging inter-
face and ensure they don't clash with each other's internal API for message formats, each
component can have its own set of private channels.
In the next few pages you'll build a simple test bed by setting up a page that loads a docu-
ment from a different domain. You can easily fake running multiple domains from your own
computer, and in this section you'll walk through setting up two pages on your computer
that run from different domains. One page will load the other in an iframe , and you'll
use channel messaging to communicate between the two. Figure F.1 shows the test bed after
channel messaging has occurred. You can use the textboxes to create the messages, and any
message received will be added to the document.