I couldn't find any good answers on stack - they related to dialog boxes, text editors, and one guy used VBScript.
I need to post a message to the window opener. This works fine in FF, Chrome and Opera, but window.opener
is null in IE8-10.
I am using window.open
to make the new window appear.
I even tried this:
var new_window = window.open( url, '_social', "height=600,width=600" );
if ( !new_window.opener ) {
new_window.opener = window;
}
The opened window simply has a script tag like this:
<script type="text/javascript">
var data = {
type : 'redirect',
destination : '<?= $destination; ?>'
};
window.opener.postMessage( JSON.stringify( data ), '*' );
window.close();
</script>
I opened the console and logged window.opener
which comes up null, so I don't think it has anything to do with the DOM being ready or not.
The window does redirect a few times before landing on the page with the script tag.
Actually, the problem may not have anything to do with window.opener – because IE8+ can only use postMessage to communciate with an iframe.
http://blogs.msdn.com/b/ieinternals/archive/2009/09/16/bugs-in-ie8-support-for-html5-postmessage-sessionstorage-and-localstorage.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With