iframe postMessage 通信
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
嵌入 iframe
<iframe
src="/model/index.html"
id="modelIframe"
name="modelIframe"
frameborder="0"
></iframe>
发送信息
let modelIframe: any;
document.getElementById('modelIframe').onload = function () {
modelIframe = window.frames['modelIframe'];
};
modelIframe.window.postMessage(['37f1adba-6b8e-4c77-ab53-173bc7a15faf']);
接受信息
window.addEventListener(
'message',
(e) => {
console.log(e.data);
sceneParse.selectObjects(e.data);
},
false,
);
感谢
iframe父子通信看这篇就够了
终于搞懂了 Iframe 跨窗口通信
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |