cgross
cgross

Reputation: 31

HTML5 PostMessage Cross-Domain Issue

I am attempting to use the HTML5 method 'postMessage'. I know this method only works in 'modern' browsers, but for my customer base, that is good enough.

Here is my situation: A browser window on domain 'abc.com' opens a new window on domain 'xyz.com'. I own both domains, and I can put any javascript I need to on either side. From what I can tell, I should be able to use 'postMessage' to send messages between the two windows. This works in Chrome, but not in IE 9. I am unable to get a reference to the parent window from the child or vice-versa. If both windows are on the same domain, I do not have a problem.

So, is this a bug ("feature") of IE's implementation of 'postMessage'? Is there any way I can accomplish what I am trying to do?

Many thanks!

Upvotes: 3

Views: 884

Answers (1)

robertc
robertc

Reputation: 75707

Unfortunately, IE's postMessage implementation only works between windows and iframes and frames. Trying it with a window.open will result in a No such interface error when postMessage is called, even though the debugger clearly shows the method existing.

Upvotes: 3

Related Questions