Hi
I am trying to listen to events from my iframe, but it just doesn't work. Even though addEventListener is supported, when I try to listen for message events, I don't get the event from my iframe. I am not sure if it's because it is running inside a worker and it has its own virtual DOM, but I don't receive the message sent by my iframe.
I have an amp-ad that generates the iframe of my ad from google ad manager. From the creative, I sent a postMessage event; however, the same code works if I run in the parent document.
Hi I am trying to listen to events from my iframe, but it just doesn't work. Even though
addEventListener
is supported, when I try to listen formessage
events, I don't get the event from my iframe. I am not sure if it's because it is running inside a worker and it has its own virtual DOM, but I don't receive themessage
sent by my iframe.The whole code from what I am trying to achieve is this:
I have an amp-ad that generates the iframe of my ad from google ad manager. From the creative, I sent a postMessage event; however, the same code works if I run in the parent document.