Send PostMessage to parent

Hi everyone,
i have a html page with iframe which source is the jitsi meet app and i add an eventListener to receive message from the iframe like

window.addEventListener( “message”,
function (e) {
console.log(e.data);
},
false);

On the index.html of the web container i want to send a message to parent like

something.postMessage({id:“TEST”});

but it doesn’t work. I tried with window.parent, window.top.

Can anyone help me please?

Thank you.

You can use theIframe.contentWindow and call postMessage on it.

sorry, i think i tried that.
on my html i have

<iframe name=“iframe_jitsi” src=“my_self_hosted_jitsi_url” ></*iframe>

on the index.html of the iframe i tried many things like
this.postMessage(…);
window.parent…;
window.top;
window;

What’s the “theIframe” in this case?

Thank you

Ah, sorry, I told you the reverse :slight_smile: This should do: window.opener || window.parent. That’s how we do it for the external API ourselves.

on the iframe html

var w = window.opener || window.parent;
console.log(w);

Uncaught DOMException: Blocked a frame with origin “https://jitsi_url” from accessing a cross-origin frame.
at console.log ()

:frowning:

Is this your own installation? You need to configure your webserver to allow the embedding origin in that case.

Yes, it is.
like this

Content-Security-Policy: frame-ancestors <source>;

in meet.conf ?

Thanks.