I was mistaken when I originally posted this answer: it doesn’t actually work in IE10. Apparently people have found this useful for other reasons so I’m leaving it up for posterity. Original answer below:
Worth noting: the link in that answer you linked to states that postMessage
isn’t cross origin for separate windows in IE8 and IE9 — however, it was also written in 2009, before IE10 came around. So I wouldn’t take that as an indication that it’s fixed in IE10.
As for postMessage
itself, http://caniuse.com/#feat=x-doc-messaging notably indicates that it’s still broken in IE10, which seems to match up with your demo. The caniuse page links to this article, which contains a very relevant quote:
Internet Explorer 8+ partially supports cross-document messaging: it
currently works with iframes, but not new windows. Internet Explorer
10, however, will support MessageChannel. Firefox currently supports
cross-document messaging, but not MessageChannel.
So your best bet is probably to have a MessageChannel
based codepath, and fallback to postMessage
if that doesn’t exist. It won’t get you IE8/IE9 support, but at least it’ll work with IE10.
Docs on MessageChannel
: http://msdn.microsoft.com/en-us/library/windows/apps/hh441303.aspx