Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2477 Näkymät

Hi all,

I have this code to initialize an iframe:


    < t t-if="lang=='en_US'">
< script id="my-corner">script for iframe
< /script >
< /t >



    
I have to call a post message on contentWindow:


document.getElementById("my-corner").contentWindow.postMessage("consentTrue","destinationurl.com");


But I'm getting this error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'postMessage')


Can anyone help to understand the error (I think it is due the iframe is not still full loaded)


Where I can put the code to call post message with no error?


Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
heinäk. 25
344
1
heinäk. 25
5206
0
heinäk. 25
730
0
kesäk. 25
822
1
kesäk. 25
986