【问题标题】:ie 9 cros domain window.open postMessage no such interface supported即 9 跨域 window.open postMessage 不支持此类接口
【发布时间】:2014-07-15 01:55:41
【问题描述】:

我想打开一个到不同域的弹出窗口并使用 postMessage 向它发送消息

代码运行在https://local_domain.test

var popupObj=window.open("https://different_domain.test/do.php", '', .....);
popupObj.postMessage("some text", "https://different_domain.test");  //other local domain for server

它适用于 chrome 和 firefox,但不适用于 ie9 我在 popupObj.postMessage 行得到“不支持此类接口”

当然,接收域有所需的代码: window.addEventListener("消息", receiveMessage, false); ......

【问题讨论】:

    标签: javascript internet-explorer cross-domain popupwindow


    【解决方案1】:

    IE9 仅部分支持postMessage:在 IE9 中,您只能在 iframe 或框架中使用 postMessage,而不能从其他窗口或选项卡中使用。这意味着特别不支持弹出窗口。

    详情见:http://caniuse.com/#search=postMessage

    作为一种解决方法,您可以尝试一些polyfills available for postMessage

    【讨论】:

    • 是的,如果您可以使用一些可用的 polyfill,您可以尝试。检查编辑。
    猜你喜欢
    • 2014-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-26
    • 1970-01-01
    • 2012-01-16
    相关资源
    最近更新 更多