Created
December 7, 2011 02:29
-
-
Save findchris/1441158 to your computer and use it in GitHub Desktop.
consumer page easyXDM Rpc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| new easyXDM.Rpc( | |
| { | |
| swf: "http://ourstaticcontent/easyxdm.swf", | |
| remote: content_url, // the URL of iframe opened by the consumer | |
| container: container, // the iframe object | |
| onReady: function() { | |
| console.log('activityFrameLoaded: onReady'); // this gets called | |
| } | |
| }, | |
| { | |
| remote: {}, | |
| local: { | |
| test:function(){...} | |
| } | |
| }); |
oyvindkinsey
commented
Dec 7, 2011
via email
2011/12/7 Chris Johnson <
reply@reply.github.com
You stress not to create the iframe, which makes sense, but as it stands
right now the consumer/host will create the iframe and set it's src to what
they get from my API. Could this work with the host page creating the
iframe? If not, what you describe is:
(1) Host/consumer page creates a container (e.g. div)
(2) Host/consumer page let's my code know that it wants the iframe to be
created inside of this div.
(3) I create an easyXDM RPC with the container set to the div from (1).
(4) This will create the iframe with the desired content in the provided
container div.
Does that sound accurate?
Quite so (just remember that the provider (the remote:) also needs to set
up its easyXDM endpoint).
Author
Ok, thanks. I set up the end point like so (in my content page):
easy_xdm_proxy = new easyXDM.Rpc(
{
swf: document.location.protocol + "//static.site/js/easyxdm.swf",
onReady: function() { console.log('provider onReady'); }
},
{
remote: { start: {} },
local: { }
});
And... the pages are communicating successfully. Despite this, I am seeing the following common XDM communication error:
Unsafe JavaScript attempt to access frame with URL http://testconsumer.com:3000/# from frame with URL http://provider/page?var=1&xdm_c=default1709&xdm_e=http%3A%2F%2Ftestconsumer.com%3A3000&xdm_p=1. Domains, protocols and ports must match.
Like I said, communication seems to work, so wondering why these errors are showing up. It looks like it occurs twice in the provider when the easyXDM RPC is created, and once in the consumer when the RPC is created.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment