When run: MyPopWindow.postMessage("Test", 'mydomaine'); I have a error on MyPopWindow whith script.google.com:
(program):1 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('mydomaine') does not match the recipient window's origin ('https://script.google.com').
When run: MyPopWindow.postMessage("Test", 'https://script.google.com'); I have a error on MyPopWindow:
dropping postMessage.. was from host mydomaine but expected host https : // ******-script.googleusercontent.com
Source in page on mydomaine:
  window.addEventListener("DOMContentLoaded", function() {
    window.addEventListener("message", function(e) {
        // wait for child to signal that it's loaded.
        if ( e.data === "loaded" && e.origin === iframe.src.split("/").splice(0, 3).join("/")) {
            // send the child a message.
            alert(e.data);
        }
    })
}, false)Source on my Google Apps Script runing as WebApp:
        document.addEventListener('DOMContentLoaded', function () {
            // signal the parent that we're loaded.
            window.parent.postMessage("loaded", "*");
            
            // listen for messages from the parent.
            window.addEventListener("message", function(e) {
            if(event.origin !== 'mydomain') return;
                  var message = e.data;
                  alert(message);
            }, false);
        }); 
     
    