Using easyXDM to communicate between a parent document and a child iframe loaded from another domain (amazon)

I am trying to use easyXDM to communicate between a parent document and a child iframe (loaded from another domain - Amazon). Iframe src is an oauth signed URL and has the following code to link to the parent document that loads it:

socket = new easyXDM.Socket({ remote: "http://localhost:56789/hitch.html", /* parent document */ remoteHelper: "http://localhost:56789/easyXDM/name.html", onMessage: function(message, origin){ alert("Received '" + message + "' from '" + origin + "'"); }, onReady: function() { socket.postMessage("Yay, it works!"); } }); 

the above code is stored in the head of the document.

In the parent (hitch.html):

 var transport = new easyXDM.Socket(/** The configuration */{ local: "/easyXDM/name.html", swf: "/easyXDM/easyxdm.swf", onMessage: function(message, origin){ transport.postMessage("This is a message received from " + location); } }); 

When I load the child iframe from amazonS3 inside the parent document, easyXDM creates another iframe inside the child iframe with src set to "http: // localhost: 56789 / hitch.html? Xdm_e = ...". This causes everything to repeat in a loop - with the parent trying again to load the child iframe, etc.

I am testing Firefox 9.0 with postMessage support. Actual messages are sent correctly and I see the messages. In addition, it also throws a "url is undefined or empty" error in the parent document when initializing easyXDM.socket, but it does not seem to affect anything else ...

Thanks,

+8
javascript html5 cross-domain iframe
source share
1 answer

I think you just returned the logic. The documentation says quite clearly:

"When using easyXDM, you first download the consumer document, and then easyXDM downloads the vendor."

The "user" is the parent document, and easyxdm loads the "provider", which is the child iframe.

ref - https://github.com/oyvindkinsey/easyXDM

+8
source share

All Articles