HTML5 PostMessage Sample

Posting Messages Cross-Domain because security policies are dumb.

HTML

<body>
    <p>Frame1 <button id="testFrame">I can post cross-domain</button></p>
    <br/>
    <iframe id="frame1" src="http://dl.dropbox.com/u/75275447/target1.html"></iframe>
    <br/>
    <p>Frame2 <button id="testFrame2">I cannot post cross-domain</button></p>
    <br/>
    <iframe id="frame2" src="http://dl.dropbox.com/u/75275447/target2.html"></iframe>
</body>

JavaScript

debugger;

$("#testFrame").click(function() {
    
    document.getElementById("frame1").contentWindow.postMessage("Hello from another domain", "http://dl.dropbox.com");
    
   //$("#frame1").contentWindow.postMessage("Hello from another domain", "http://dl.dropbox.com");
});

$("#testFrame2").click(function() {
    document.getElementById("frame2").contentWindow.postMessage("Hello from another domain", "http://dl.dropbox.com");
   $("#frame2").contentWindow.postMessage("Hello from another domain", "http://dl.dropbox.com");
});