发送消息到父窗口
setInterval(() => {
window.parent.postMessage('Nice to see you', '*');
}, 300);
发送消息给 iframe
document.getElementById('iframe_id').contentWindow.postMessage('Nice to see you', '*');
发送消息到父窗口
setInterval(() => {
window.parent.postMessage('Nice to see you', '*');
}, 300);
发送消息给 iframe
document.getElementById('iframe_id').contentWindow.postMessage('Nice to see you', '*');
本文标题:postMessage的实践
本文链接:https://www.haomeiwen.com/subject/hrmhurtx.html
网友评论