Re: iframes between 3 different domains

148 views
Skip to first unread message

Øyvind Sean Kinsey

unread,
Jul 2, 2012, 2:07:23 AM7/2/12
to eas...@googlegroups.com
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.p...@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);
    };
}

I tried adapting code from http://easyxdm.net/wp/2010/03/17/resize-iframe-based-on-content/ but could not make that to work.
I'd appreciate if anyone could direct me to some examples.

swiniak

unread,
Jul 5, 2012, 4:37:22 PM7/5/12
to eas...@googlegroups.com
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

Øyvind Sean Kinsey

unread,
Jul 5, 2012, 6:58:15 PM7/5/12
to eas...@googlegroups.com
A > B > C would never work if it had to fall back to the hashtransport.. 

Øyvind Sean Kinsey
San Francisco, CA
Reply all
Reply to author
Forward
0 new messages