I have an ad that creates an iframe in a different domain and then uses the postMessage method to communicate back and forth with the parent. However, even though I add a message event listener on the parent window as follows:
goog.events.listen(
window,
goog.events.EventType.MESSAGE,
this.onMessage_,
false,
this
);
by the time the code in the frame makes the call to postMessage:
window.parent.postMessage('myMessage', '*');
It never gets received by the parent.
On closer examination, I have noticed that the event listener above was removed by the time the child sends the events.
Does anyone have any ideas what is removing the listener and why? More importantly, how do I stop it from doing so?