我知道与iframe
通信的唯一方法是使用postMessage
方法,如下所示:
iframe.contentWindow.postMessage("my message", window.location.href);
但我想知道如何对
iframe
进行更改后如何接收数据。
最佳答案
在接收者窗口中,当您收到消息时,将使发送者与消息一起传递,然后可以发送回该发送者。
window.onMessage.listen((e) {
e.source.postMessage({'somedata': 'xxx'}, '*');
});
也可以看看
关于iframe - 如何在Dart中从iframe接收数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29934147/