gpt4 book ai didi

javascript - 为什么要使用 easyXDM 进行简单的跨域消息传递?

转载 作者:行者123 更新时间:2023-11-30 06:52:05 25 4
gpt4 key购买 nike

我有一个客户建议我实现一个旧版本的 easyXDM 来将简单的跨域消息从 iframe 内容发送到它的父窗口。我的最低浏览器要求是 IE11 及更高版本。

为什么我应该在 window.postMessage 之类的东西上使用它?

最佳答案

我认为您无法使用 easyXDM 实现您想要的,如文档所述:

easyXDM provides a transport stack capable of passing string based messages between two windows, a consumer (the main document) and a provider (a document included using an iframe).

easyXDM docs

这意味着您可以将消息从父窗口发送到包含的 iframe,但反之则不行。

这就是坚持使用 window.postMessage 方法的充分理由。

关于javascript - 为什么要使用 easyXDM 进行简单的跨域消息传递?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37643167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com