Marco Calì Marco Calì - 1 year ago 79
Javascript Question

Trigger Custom Event From Iframe To Parent Document

I am having some trouble to fire a custom event inside an iframe and detect it from the parent document.
Both iframe and parent document have the same source (same protocol, same host, same port).

Any advises?

Answer Source

This works:


the event triggered inside the iframe will be detected in the parent document.