How to use postMessage from an iframe with different origin?

Thank you, I tried window.parent.postMessage(“msg”, “*”). I was testing in the preview which has a different url than the production website and that was blocking the messaging. I still get the javascript error but the Messaging works so I imagine it is unrelated to my script.