iframe 和父级通讯
时间: 2023-10-04 19:07:27 浏览: 82
在网页开发中,当一个iframe与其父级页面处于不同的域名或端口号时,即构成跨域问题。跨域问题会导致iframe无法直接与父级页面进行通讯和操作。然而,我们可以通过使用postMessage方法来解决这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [解决iframe跨域跟父级进行通讯问题【postMessage】 重点是跨域进行通讯!](https://blog.csdn.net/Qin_HongKun/article/details/113058541)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [iframe中父级数据传到子级父子通讯postMessage](https://blog.csdn.net/weixin_44292923/article/details/123281862)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文