跨域Iframe通信

Cross domain Iframe communication

本文关键字:通信 Iframe 跨域      更新时间:2023-09-26

假设www.site1.com有一个iframe到www.site2.com

<iframe src="http://www.site2.com" ></iframe>

有什么方法可以和他们沟通吗?

查看postMessage API。它将需要一些架构工作,但是如果需要的话,可以使用它来模拟CORS支持。

https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage