child.postMessage 无法在 Microsoft Edge 中的 IE11 兼容 Web 应用程序中工作
我正在尝试在 IE 11 兼容的 Web 应用程序和使用 window.open 打开的弹出窗口之间进行通信。下面是我在 IE11 兼容的 Web 应用程序中使用的代码:
var options = 'titlebar=no,resizable=no';
var url = '<different app url but within same org>';
var child = window.open(url,'window',options);
child.postMessage({message: 'requestResult'},'*');
这在 Chrome 和 IE 中工作,但在 Microsoft Edge 中失败。我无法在 Edge 的子弹出窗口中接收消息。 任何人都可以检查并告诉我为什么它在 Edge 中失败。
I am trying to communicate between a IE 11 compatible web application and pop-up window opened using window.open. Below is the code I am using in IE11 compatible web application:
var options = 'titlebar=no,resizable=no';
var url = '<different app url but within same org>';
var child = window.open(url,'window',options);
child.postMessage({message: 'requestResult'},'*');
This is working in chrome and IE, but it's failing in Microsoft Edge. I cannot receive message in child popup window in Edge.
Can anyone please check and let me know why it's failing in Edge.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为
window.open()
打开的页面应该在Edge而不是Edge IE模式下运行。如果是这种情况,您需要在Edge IE模式站点列表中配置打开的页面来实现您的需求。您甚至可以简单地尝试输出子窗口句柄:
child
对象。你会发现它是Null而不是[window object]。这是因为这两个页面运行在不同的浏览器(IE 和 Edge)中。有关如何配置 IE 模式的更多详细信息,您可以参考此文档:配置 IE 模式策略
。
I think the page opened by
window.open()
should be running in Edge instead of Edge IE mode. If this is the case, you need to configure the opened page in the Edge IE mode site list to achieve your needs.You can even simply try to output the child window handle:
child
object. You will find that it is Null instead of [window object]. This is because the two pages are running in different browsers (IE and Edge).For more details about how to Configure IE mode, you could refer to this doc:Configure IE mode policies
.