我在堆栈上找不到任何好的答案 - 它们与对话框、文本编辑器有关,并且有人使用 VBScript。
我需要向开窗器发送消息。这在 FF、Chrome 和 Opera 中运行良好,但是window.opener
在 IE8-10 中为空。
我在用window.open
使新窗口出现。
我什至尝试过这个:
var new_window = window.open( url, '_social', "height=600,width=600" );
if ( !new_window.opener ) {
new_window.opener = window;
}
打开的窗口只有一个脚本标签,如下所示:
<script type="text/javascript">
var data = {
type : 'redirect',
destination : '<?= $destination; ?>'
};
window.opener.postMessage( JSON.stringify( data ), '*' );
window.close();
</script>
我打开控制台并登录window.opener
结果为 null,所以我认为这与 DOM 是否准备好没有任何关系。
该窗口在登陆带有 script 标签的页面之前确实会重定向几次。
实际上,这个问题可能与 window.opener 无关——因为 IE8+ 只能使用 postMessage 与 iframe 进行通信。
http://blogs.msdn.com/b/ieinternals/archive/2009/09/16/bugs-in-ie8-support-for-html5-postmessage-sessionstorage-and-localstorage.aspx http://blogs.msdn.com/b/ieinternals/archive/2009/09/16/bugs-in-ie8-support-for-html5-postmessage-sessionstorage-and-localstorage.aspx
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)