JSFiddle - React, Tailwind, and code Playground

by dandiebolt

HTML

<script src="http://onlineaspect.com/uploads/postmessage/postmessage.js"></script>
<h1>Parent</h1>

<span id="here">click</span>

<hr />

<iframe id='xd_frame' src='http://jsbin.com/uduyas/5/' width='500' height='250' name="xd_frame"></iframe>

JavaScript

var src = 'http://jsbin.com/uduyas/4#' + encodeURIComponent(document.location.href);
document.getElementById("xd_frame").src = src;

function sendx(msg) {
    alert("in parent sending: " +msg);
    alert(src);
    XD.postMessage(msg, src, frames[0]);
    alert("in parent sending2: " +msg);
    return false;
}
    
XD.receiveMessage(function(message){
    alert("in parent receiving: " +message);
 window.alert(message.data + " received on "+window.location.host);
}, 'http://jsbin.com/uduyas/5/');

$("#here").click(function(){
   sendx("hello");
});