Solution 1 :

When getting javascript to interact between documents. postMessage is the proper way to do it.

https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

exact implementation is up to you depending on your problem.

Problem :

When I have HTML embedded in another server’s response and I own both of the servers, Is it possible to allow the embedded document to access the parent document or vis versa?

server one returns

<embed src="http://server_2.com/stuff"></embed>

I want to listen for JS events from one doc to the other.

Perhaps there is a header I can set?

By