使用iframe+postMessage解决跨域问题,首先来过一遍其中的原理咯 原理: 发送方使用postMessage方法向接收方推送消息,第一个参数为推送的内容,第二个参数是允许被访问的域名: 接收方通过监听message的方法接收数据. 实现跨域就需要有两个不同源的服务器咯 我在本地开启了两个不同端口的tomcat:(以下是我的文件路劲) ①tomcat/webapps/iframe/parent.html(端口号8088) ②tomcat1/webapps/iframe/child.ht…