- Legacy browser such as IE6, IE7 doesn't support `window.postMessage` - Fallbacks: `window.name`, using URL fragment identifier (or hash), using an Adobe Flash object - This techniques skips SOP checks, somehow - easXDM is for enhanced fallback support - *`window.message` technique* - open iframe within in the doucment, which has cross-domain src, set `window.name` property with desired message, and redirect it to parent document's origin's page -- so now the iframe hosts a document on the same domain of parent document, and still contains the value of `window.name` which was set earlier. ```javascript // in document on publisher's domain (where we're listening for a message) // create iframe var iframe = document.createElement('iframe'); var body = document.getElementsByTagName('body')[0]; iframe.style.display = 'none'; iframe.src = 'http://3rdpartyserver.com/nametransport/server.html'; // remote iframe page url var done = false; // event handler fires when iframe loads new document iframe.onreadystatechange = function () { if (iframe.readyState !== 'complete' || done) { return; } console.log('Listening'); var name = iframe.contentWindow.name; // window.name returns undefined if inaccessible if (name) { console.log('Data: ' + iframe.contentWindow.name); done = true; } }; body.appendChild(iframe); ``` ```html
``` - this is bad, it's uncertain that publisher might host `empty.html` or we've to redirect to random 404 page, but it will unnecessarily increase traffic on publisher's site by doing like so. But in easyXDM, such static empty.html page is forcefully cached and overcome this issue.