Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2499 Lượt xem

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?


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 8 25
5
0
thg 7 25
404
1
thg 7 25
5284
0
thg 7 25
829
0
thg 6 25
842