Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://xxx.cn’) does n

Failed to execute ‘postMessage’ on ‘DOMWindow’: The Target Origin Provided (‘https://xxx.cn’) Does not match The Window’s Origin (‘null’).
Using the event. The source </ code> object as a letter
specific see: https://developer.mozilla.org...

// This function is called by addEventListenner when the A page postMessage is called.
function receiveMessage(event)
{
  // Can we trust the source of the information?
  if (event.origin ! == "http://example.com:8080")
    return;

  // event.source on the source page of the current popup page.
  // event.data is "hello there!"

  // Assuming you've already verified the origin of the received message (which you should do any time), a handy way to do this is to add the enent.source
  // as the object of the reply, and use event.origin as the targetOrigin.
  event.source.postMessage("hi there yourself! the secret response " +
                           "is: rheeeeet!",
                           event.origin);
}

window.addEventListener("message", receiveMessage, false);

The answer is helpful, it’s valuable 0 it’s not helpful, it’s the wrong answer, irrelevant answer
otherWindow.postMessage(message, targetOrigin, [transfer]);
otherWindow: a reference to another window, such as the contentWindow property of the iframe, the window object that executes window.open, or the named or numerically indexed window.frames.
otherWindow cannot be the current window oh
see MDN

Read More: