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", 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({ 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,
javascript html5 cross-domain iframe
ivymike
source share