JSFiddle - React, Tailwind, and code Playground

by dandiebolt

HTML

<script src="http://onlineaspect.com/uploads/postmessage/postmessage.js"></script>
<h1>Parent</h1>
<a href='#' onclick="send('hello world')">Send "hello world" </a>

<hr />

<iframe id='xd_frame' src='http://alpha.jsfiddle.net/dandiebolt2/XAHDw/show/' width='500' height='250' name="xd_frame"></iframe>

JavaScript

var src = 'http://alpha.jsfiddle.net/dandiebolt2/XAHDw/show/#' + encodeURIComponent(document.location.href);
document.getElementById("xd_frame").src = src;

function send(msg) {
    alert("in parent sending: " +msg);
    XD.postMessage(msg, src, frames[0]);
    return false;
}
    
XD.receiveMessage(function(message){
    alert("in parent receiving: " +message);
 window.alert(message.data + " received on "+window.location.host);
}, 'http://alpha.jsfiddle.net/');