It might be a silly question but I have almost no experience with JavaScript and I could not find any examples of communication across three domains.
What I have is domain A that returns iframe from domain B and domain B returns iframe from domain C. Domain A exposes *DA.resize(i,j)* via easyXDM already, so I can easily access this from domain B. Now I'd like to have same action from domain C (so that the top most iframe from domain A is resized). The exposed DA thingie looks something like this:
var DA = (function () { var DA = DA || {}; var rpc; DA.init = function (options) { rpc = new easyXDM.Rpc({}, { remote:{ resize:{}, init:{}, }, }); rpc.init(); DA.resize(); };
DA.resize = function (width, height) { var w = width || "100%"; var h = height || (document.body.offsetHeight + 40); rpc.resize(h, w); };
A provider cannot directly act as a consumer due to conflicts in the
messaging stack - if you need this then you need to introduce a second
iframe (just as in the intermediary example) so that you have A(consumer) >
B(provider) > B(consumer) > C(provider)
- Sean
On Thu, Jun 21, 2012 at 11:33 PM, swiniak <andrzej.pasterc...@googlemail.com
> It might be a silly question but I have almost no experience with
> JavaScript and I could not find any examples of communication across three
> domains.
> What I have is domain A that returns iframe from domain B and domain B
> returns iframe from domain C.
> Domain A exposes *DA.resize(i,j)* via easyXDM already, so I can easily
> access this from domain B. Now I'd like to have same action from domain C
> (so that the top most iframe from domain A is resized).
> The exposed DA thingie looks something like this:
> var DA = (function () {
> var DA = DA || {};
> var rpc;
> DA.init = function (options) {
> rpc = new easyXDM.Rpc({}, {
> remote:{
> resize:{},
> init:{},
> },
> });
> rpc.init();
> DA.resize();
> };
> DA.resize = function (width, height) {
> var w = width || "100%";
> var h = height || (document.body.offsetHeight + 40);
> rpc.resize(h, w);
> };
> }
OK, now I see... so B -> B will not be in conflict with same origin policy and then it will work... nice. It's hard to admit but I went into some strange way with modifying easyXDM script (changing few variable names and similar ridiculous things)... I did force it to work without additional iframe (so I have A -> B -> C only). But I guess I'll change the approach later.
Thanks,
Andrzej
W dniu poniedziałek, 2 lipca 2012 08:07:23 UTC+2 użytkownik Øyvind Sean Kinsey napisał:
> A provider cannot directly act as a consumer due to conflicts in the > messaging stack - if you need this then you need to introduce a second > iframe (just as in the intermediary example) so that you have A(consumer) > > B(provider) > B(consumer) > C(provider)
> - Sean
> On Thu, Jun 21, 2012 at 11:33 PM, swiniak <
> andrzej.pasterc...@googlemail.com> wrote:
>> Hi,
>> It might be a silly question but I have almost no experience with >> JavaScript and I could not find any examples of communication across three >> domains.
>> What I have is domain A that returns iframe from domain B and domain B >> returns iframe from domain C.
>> Domain A exposes *DA.resize(i,j)* via easyXDM already, so I can easily >> access this from domain B. Now I'd like to have same action from domain C >> (so that the top most iframe from domain A is resized).
>> The exposed DA thingie looks something like this:
>> var DA = (function () {
>> var DA = DA || {};
>> var rpc;
>> DA.init = function (options) {
>> rpc = new easyXDM.Rpc({}, {
>> remote:{
>> resize:{},
>> init:{},
>> },
>> });
>> rpc.init();
>> DA.resize();
>> };
>> DA.resize = function (width, height) {
>> var w = width || "100%";
>> var h = height || (document.body.offsetHeight + 40);
>> rpc.resize(h, w);
>> };
>> }
> OK, now I see... so B -> B will not be in conflict with same origin policy
> and then it will work... nice.
> It's hard to admit but I went into some strange way with modifying easyXDM
> script (changing few variable names and similar ridiculous things)... I did
> force it to work without additional iframe (so I have A -> B -> C only).
> But I guess I'll change the approach later.
> Thanks,
> Andrzej
> W dniu poniedziałek, 2 lipca 2012 08:07:23 UTC+2 użytkownik Øyvind Sean
> Kinsey napisał:
>> A provider cannot directly act as a consumer due to conflicts in the
>> messaging stack - if you need this then you need to introduce a second
>> iframe (just as in the intermediary example) so that you have A(consumer) >
>> B(provider) > B(consumer) > C(provider)
>> - Sean
>> On Thu, Jun 21, 2012 at 11:33 PM, swiniak <andrzej.pasterczyk@**
>> googlemail.com <andrzej.pasterc...@googlemail.com>> wrote:
>>> Hi,
>>> It might be a silly question but I have almost no experience with
>>> JavaScript and I could not find any examples of communication across three
>>> domains.
>>> What I have is domain A that returns iframe from domain B and domain B
>>> returns iframe from domain C.
>>> Domain A exposes *DA.resize(i,j)* via easyXDM already, so I can easily
>>> access this from domain B. Now I'd like to have same action from domain C
>>> (so that the top most iframe from domain A is resized).
>>> The exposed DA thingie looks something like this:
>>> var DA = (function () {
>>> var DA = DA || {};
>>> var rpc;
>>> DA.init = function (options) {
>>> rpc = new easyXDM.Rpc({}, {
>>> remote:{
>>> resize:{},
>>> init:{},
>>> },
>>> });
>>> rpc.init();
>>> DA.resize();
>>> };
>>> DA.resize = function (width, height) {
>>> var w = width || "100%";
>>> var h = height || (document.body.offsetHeight + 40);
>>> rpc.resize(h, w);
>>> };
>>> }