Posting an "I am ready" message should work.
Parent:
var child = window.open(childURL);
window.addEventListener("message",(e)=>{
if(e.data == "ready")
{
e.source.postMessage("some data for you","*");
}
})
Child:
window.addEventListener("load",()=>{
window.opener.postMessage("ready","*");
})
window.addEventListener("message",(e)=>{
console.log(e.data);
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…