postMessage between cross-domain windows not working in IE10 (it works for frames)

二次信任 提交于 2019-12-01 05:47:13

IE does not support postMessage between cross-domain popup windows(eg:window.open). IE does support postMessage for embedded frames(eg:top.frames).

So I end up by putting a frame into a dialog, pretending like a popup windows. eg:

With the help of Jquery UI dialog

<script>
$("#dialog").dialog({
    autoOpen: false,
    modal: true,
    height: 300,
weight: 400,
});

function openiframe(){
   $('#dialog').dialog('open');
});
</script>

<p>At 120.0.0.211 server</p>
<button type="button" onclick="openiframe()">send the message!</button>
<div id="dialog">
   <iframe id="iframe" src="http://192.168.15.223/smallframe"></iframe>
</div>

It might be other solutions/technologies out there for commutation between cross-domain windows:

  1. Cross-Origin Resource Sharing (CORS) using Ajax.

  2. Using Webservice like REST, which actually is a server-to-server commutation, not a server-broswer-server struct anymore. But it is a way how we can send some message to another server. For some frameworks it is easy to setup REST eg: cakephp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!