Javascript 通过多个不友好的iFrame发送邮件

Javascript 通过多个不友好的iFrame发送邮件,javascript,Javascript,我有三个不同的域名(DomainA.com、DomainB.com、DomainC.com) 我尝试通过以下方式将postMessage从domainC发送到domainA: window.parent.postMessage('foo','https://domainA') // this sends it just to the parent which works fine 我还尝试了window.frames,希望向所有帧发送消息 window.frames.postMessage

我有三个不同的域名(DomainA.com、DomainB.com、DomainC.com)

我尝试通过以下方式将postMessage从domainC发送到domainA:

window.parent.postMessage('foo','https://domainA') // this sends it just to the parent which works fine

我还尝试了window.frames,希望向所有帧发送消息

window.frames.postMessage('foo','https://domainA') // or
window.frames.postMessage('foo','*')
调试时,我看到window.frames在domainC上执行时显示长度为0。这对处理父iFrame有用吗

我可以用什么方式从域C到域A进行通信?

你是说像这样?你是说像这样?