SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cross-domain iframe communication in Opera

    Hi,

    I have need to communicate between two iframes of the same domain, which live inside a parent page on a different domain that I have no control over.

    This is a Facebook app and the basic layout is this

    apps.facebook.com/myapp
    L iframe1 (src='mysite.com/foo')
    L iframe2 (src='mysite.com/bar')

    I need frame1 to talk to frame2, but in Opera I can't access window.parent.frames['frame2'] to do the usual cross-domain methods (updating location.hash for example)

    Is there an alternate way to accomplish this in Opera?

    Thanks for your help in advance

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, thanks.

    That is already the method I am using. The problem with Opera is getting the handle on the iframe window, which I cannot do using "parent.window.frames".

    If I were able to get a handle on the frame, I could also use html5 postMessage in Opera.

    So, I guess to rephrase my question, is there any alternate way for a child iframe to get a handle on a sibling frame of the same domain if both frames live in a parent page of a different domain (which I do not have control of)

    Thanks

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    There is no other direct way that I'm aware of. As far as I know the only other alternative is to set up a polling station for the both of them.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ugh, I was afraid of that.

    Thanks for the help.

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    What you could do though is to use an object detection technique. Do not however perform an explicit check for Opera, because then you will be explicitly denying a solution for any other browser that has a similar problem.

    Confirm from scripting whether you can communicate with the other frame. If you can't communicate with it using the standard fashion, only then use polling as a fallback solution.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •