Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
communicating between 2 iframes
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
kartsims  
View profile  
 More options Jul 4 2012, 1:09 pm
From: kartsims <karts...@gmail.com>
Date: Wed, 4 Jul 2012 10:09:26 -0700 (PDT)
Local: Wed, Jul 4 2012 1:09 pm
Subject: communicating between 2 iframes

Hello everyone,

First of all, thanks to Øyvind Kinsey for his great work, who made the job
so easier for cross domain messaging. Even though it remains quite
complicated, you opened a wide way through it ;-)

So let me introduce to you the problem we are actually dealing with :
We have a client that won't let us host our scripts on his domain, and is
therefore pushing us to use this brillant piece of code that is easyXDM. We
already implemented an iframe there a while ago (fetching a page from our
domain, and displaying it in the main section of the website) and are about
to implement a second one which is a widget in the sidebar. As we are using
user authentication and various actions in both iframes (main iframe and
widget), we would like the 2 iframes to communicate with each other and be
able to trigger js events one on the other.

Let me add that their domain is actually calling a script (js) from our
domain as well, which is initializing the widget. So we can execute
javascript on the main page as well, but we will do so as few as possible.

We have been trying many different ways to make the 2 iframes communicate
and there are the most advanced (or close to the point) :

- Establishing 2 page<->iframe connections between the main page and both
iframes
this is not the best solution ever as it was loading more script to the
initial website (easyXDM, eventually JSON2, flash...) and more importantly,
loaded iframes inside iframes which already contained iframes... a real
mess, occasionnally freezing some browsers. Indeed not the best solution.

- Establishing a direct link between the 2 iframes (even if they are hosted
on the same domain)
easyXDM recognize that they are on the same domain and uses appropriate
method (SOP)
BUT the javascript actions occur in easyXDM's hidden generated iframe and
not in the iframe displayed. If I trigger a document.createElement, it
would be shown in the iframe displayed, but in the hidden easyxdm's one.
My guess is that they don't find each other, as they are both enclosed in a
page hosted on another domain. Guess the browser can't do that, can it ?

I may add that we are just trying to establish any kind of communication as
we are only dealing with basic actions. We tried implementing easyXDM.Rpc
though, with all (un)success described above. We are currently thinking
about more basic solutions (as window.hash communication) but can't be sure
to get 100% cross-browser compatibility before trying and this is already
taking a lot of time and effort, and we would prefer to go through a tested
solution.

Would anyone have a brillant idea on how to make this work ? Or at least
explain what went wrong... I have crawled the easyXDM documentation and the
Third-Party Javascript book (still in its early edition but yet very
interesting, more info : http://thirdpartyjs.com/)

Any feedback appreciated, I hope my English was fine and the explanation
too. If anything sounds blurry, please ask.

Cheers,
Simon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Øyvind Sean Kinsey  
View profile  
 More options Jul 4 2012, 9:47 pm
From: Øyvind Sean Kinsey <oyv...@kinsey.no>
Date: Wed, 4 Jul 2012 18:47:43 -0700
Local: Wed, Jul 4 2012 9:47 pm
Subject: Re: communicating between 2 iframes

The two iframes are on the same domain?
If so, then simply load the second iframe normally (no easyXDM) and use
`parent.frames[frameName]` to access the sibling frame from either one. You
can easily control the name by setting the channel property which will make
the window name deterministic.
If your doing anything onload, then you'll have to account for any of the
two iframes rendering after the other, so a retry strategy must be applied.

When you described that the actions were performed in the hidden iframe
this is because easyXDM is designed to create the window it's talking to -
it cannot be used to interface directly with preexisting windows, nor can
it create iframes in other windows.

Øyvind Sean Kinsey
San Francisco, CA


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kartsims  
View profile  
 More options Jul 5 2012, 4:10 am
From: kartsims <karts...@gmail.com>
Date: Thu, 5 Jul 2012 01:10:33 -0700 (PDT)
Local: Thurs, Jul 5 2012 4:10 am
Subject: Re: communicating between 2 iframes

Thank you for your quick answer :-)

So to sum it all up, here is what I am about to do :

- my parent page loads an iframe and starts an easyxdm connection with it,
specifying channel property to easyxdm on the consumer page

- once easyxdm is ready, i load the other iframe (the widget)

- and then, from both iframes, I can use parent.frames[frameName] or maybe
parent.frames[channelName], something like that ?!

I am trying this today, I'll let you know !


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »