Issue communication with postMessage from parent to child iFrame

前端 未结 2 957
青春惊慌失措
青春惊慌失措 2021-01-12 21:36

I\'m having an issue communicating from my parent window to the child iFrame. But in the other side, everything works perfectly. Here is how I get the chil iFrame object in

2条回答
  •  再見小時候
    2021-01-12 22:08

    try this

    var iFrame = document.getElementById('Frame');
    iFrame.contentWindow.postMessage("message", "http://contoso.com");
    

    I had this problem too. I found solution from this website https://www.viget.com/articles/using-javascript-postmessage-to-talk-to-iframes

提交回复
热议问题