JSFiddle - React, Tailwind, and code Playground

by Douglas Duhaime

JavaScript

function loadiframe (callback) {
    var body = document.getElementsByTagName('body')[0];
    var iframe = document.createElement('iframe');
    iframe.id = 'iframe';
    iframe.seamless = 'seamless';
    iframe.src = 'http://www.dotrob.com/demo/messaging/iframe.html';
    body.appendChild(iframe);
    window.setTimeout(callback, 1000);
}

loadiframe(function() {
    cpframe = document.getElementById('iframe').contentWindow;
    cpframe.postMessage('please get this message','*');
    console.log('posted');
})