parent. Before gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / Seamonkey 2.3), the parameter message must be a string; the second parameter is the domain name restriction. The HTML 5 postMessage function is used to send HTTP requests to the iframe, and to send HTTP responses back to the source document. If window.postMessage is not available, the target window's location.hash will be used to pass the message. to install it. Now that you understand how to use postMessage() to pass messages between two windows on different domains lets take a look at an example.. window.postMessage example. We will create a receiveMessage Function on our outer window, check if the event.origin is the domain of our iframe and if event.data is the message we exppect. Most articles go in depth of how and why, rather than serve as a quick recap, so I'll try to do that here. Found inside – Page 225chunked encoding, 175 gzip compression, 122 iframe support, 181 postMessage method, 117 stripping attribute quotes, ... 69–73 coupling, 41 defined, 27 loading multiple scripts, 60–62 loading single scripts, 59 menu.js code example, ... Thanks for this great live example. Suppose there is a parent page indexpage.html and a child page iframepage.html, 1ã Parent page sends message to child page, iFrame.contentWindow.postMessage(‘MessageFromIndexPage’,’b.com’). View on GitHub iFrameX is a javascript class for generate iframes with a really simple schema, also have a custom event listener. parent.postMessage - This is used to pass event data back to the parent domain. Found insideYou can always call postMessage() on it. Let's build a very simple example. Say that we have a parent page that has an iframe inside it. The iframe's src points to a thirdparty website that provides us with a random image. getElementsByTagName ('iframe')[0]; o. contentWindow. Found insideConsider this example: //note: all browsers that support XDM also support iframe contentWindow var iframeWindow = document.getElementById("myframe").contentWindow; iframeWindow.postMessage("A secret", "http://www.wrox.com"); ... Found inside – Page 13Let's see an example of such a process. Here is the HTML code of the parent document: