Set Parent Scroll Position - parent page and iframe on seperate domains

Discussion in 'Javascript' started by PD, May 3, 2006.

  1. PD

    PD Guest

    I have a parent .Net page (http://mywebsite/project.aspx) that has an
    iframe (http://iframe/iframe.aspx) which are on seperate domains. I
    need to adjust the scrolling on the parent window due the size of the
    iframe. It displays a rather lengthy message which causes scrolling on
    the parent page (not in the iframe) which is what the UI folks want. I
    need to be able to scroll the parent page from a click in the iframe.
    After they read this message, they click on a link at the bottom. At
    that point, they get redirected to another page, but the scroll
    position remains, so they can't see the new page content since it's not
    that lengthy. Each time I try to access either parent.window.scollTo or
    a function on the parent page from the iframe I get an access denied. I
    have read posts that state you can not go across domains, hence the
    access denied error.

    Is there another way that I can set the scroll position on the parent
    page from the iframe page?

    Any thoughts/suggestions would be greatly appreciated.

    PD
    PD, May 3, 2006
    #1
    1. Advertising

  2. PD

    ASM Guest

    Re: Set Parent Scroll Position - parent page and iframe on seperatedomains

    PD a écrit :
    > I have a parent .Net page (http://mywebsite/project.aspx) that has an


    I saw any iframe in 'project.aspx' ... !



    --
    Stephane Moriaux et son [moins] vieux Mac
    ASM, May 3, 2006
    #2
    1. Advertising

  3. PD

    PD Guest

    I just made those names up to ensure the difference between the 2
    domains.
    PD, May 4, 2006
    #3
  4. PD

    ASM Guest

    Re: Set Parent Scroll Position - parent page and iframe on seperatedomains

    PD a écrit :
    > I just made those names up to ensure the difference between the 2
    > domains.


    but, as I don't understand your question about parent scrolling ...

    in the iframe, the link :
    <a href="#" onclick="parent.location=parent.location+'#somewhere';
    retur false;">somewhere</a>

    won't scroll to div of id 'somewhere' in main page ?

    --
    Stephane Moriaux et son [moins] vieux Mac
    ASM, May 4, 2006
    #4
  5. PD

    PD Guest

    I get a "access denied" message because the main page resides on a
    differnet domain then the iframe page.
    PD, May 4, 2006
    #5
  6. PD

    ASM Guest

    Re: Set Parent Scroll Position - parent page and iframe on seperatedomains

    PD a écrit :
    > I get a "access denied" message because the main page resides on a
    > differnet domain then the iframe page.


    the alone way I found is to use 'normal' html

    http://stephane.moriaux.perso.wanadoo.fr/truc/test_iframe_denied
    scroll down to the white iframe

    3 examples :
    -1- in pure html (with target)
    -2- with some JS accepted by my Fx (compatible strict ?)
    and I don't know why that works ? !
    -3- doesn't work : calling parent.location ==> 'denied'

    other tests using similar location.href directly in onclick in links
    returned 'denied'

    test using a variable getting self.location in parent file
    ==> denied too ... :-(


    --
    Stephane Moriaux et son [moins] vieux Mac
    ASM, May 4, 2006
    #6
  7. PD

    PD Guest

    Thanks for the info!! I'll take a look at the 'normal' html example.
    PD, May 9, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. moondaddy
    Replies:
    2
    Views:
    578
    Steven Cheng[MSFT]
    Oct 16, 2006
  2. Mel
    Replies:
    3
    Views:
    12,020
    Alexey Smirnov
    Jun 23, 2009
  3. Alexander
    Replies:
    1
    Views:
    591
    Grunken
    Apr 21, 2004
  4. Replies:
    2
    Views:
    589
  5. Brent
    Replies:
    2
    Views:
    201
    Brent
    May 15, 2008
Loading...

Share This Page