JSFiddle - React, Tailwind, and code Playground

by Trevor W

HTML

<iframe id="foo" src="https://release.dnzz1g49dkqfw.amplifyapp.com/">
  
</iframe>

CSS

iframe{
  width: 100%;
  height: 600px;
}

JavaScript

window.onload = function() {
    var win = document.getElementById('foo').contentWindow;

    win.postMessage(JSON.stringify({

        key: 'superStuff',
        data: "theDatas"

    }), "*");

};
 
 
window.onmessage = function(e) {

     var payload = JSON.parse(e.data);
     let bar = localStorage.testerino;
     console.log("bar",bar);
     localStorage.setItem(payload.key, payload.data);

};