Pass extra data to the iframe in the querystrng / hash tag for before easyXDM is initialized?

122 views
Skip to first unread message

Nathan Friedly

unread,
Aug 31, 2010, 6:15:24 PM8/31/10
to eas...@googlegroups.com
Hi, is there a way to pass extra data along to the iframe in either the querystring or the hash that js in the iframe can access before easyXDM is initialized?

I'm currently doing this right after initializing easyXDM on the parent page:

var iframes = document.getElementsByTagName('iframe');
var iframe = iframes[iframes.length -1];
iframe.src = iframe.src + '#' + this.get(CDN);

And that works but it shows two load attempts in firebug, one that was aborted, and then a second with the hash. Is there a way to make easyXDM put the extra data in the iframe tag initially?

(I know I could hard-code the cdn url into the iframe, or have the server generate the iframe with the correct url in it, but this seemed like the simplest way to do things.)

Thanks for the great library and all your hard work
-Nathan

Øyvind Sean Kinsey

unread,
Aug 31, 2010, 6:27:19 PM8/31/10
to eas...@googlegroups.com
On Wed, Sep 1, 2010 at 12:15 AM, Nathan Friedly <nathan....@gmail.com> wrote:
Hi, is there a way to pass extra data along to the iframe in either the querystring or the hash that js in the iframe can access before easyXDM is initialized?
You are free to use a 'provider' url with both query parameters and a hash. easyXDM's arguments are prefixed with xdm_. 

I'm currently doing this right after initializing easyXDM on the parent page:

var iframes = document.getElementsByTagName('iframe');
var iframe = iframes[iframes.length -1];
iframe.src = iframe.src + '#' + this.get(CDN);
This is really not advised as easyXDM uses the hash for its fallback transport. Modifying this on your own might have unknown results. 

And that works but it shows two load attempts in firebug, one that was aborted, and then a second with the hash. Is there a way to make easyXDM put the extra data in the iframe tag initially?

(I know I could hard-code the cdn url into the iframe, or have the server generate the iframe with the correct url in it, but this seemed like the simplest way to do things.)
 
Just add your data to the initial url, it should work :) 

Sean

Nathan Friedly

unread,
Aug 31, 2010, 6:45:47 PM8/31/10
to eas...@googlegroups.com
Works beautifully. I should have thought of trying something that simple. Thanks again!

2010/8/31 Øyvind Sean Kinsey <oyv...@kinsey.no>

Øyvind Sean Kinsey

unread,
Aug 31, 2010, 6:55:07 PM8/31/10
to eas...@googlegroups.com
Some things has been thought of you know :)


Øyvind Sean Kinsey
oyv...@kinsey.no
http://kinsey.no/blog/index.php/about/
Reply all
Reply to author
Forward
0 new messages