iframes and parent window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stimp

    #1

    iframes and parent window

    I have an IFRAME on a webpage with a large height to accommodate a big
    list output in the frame.

    If I go down the list and click a row, a new page opens in the IFRAME,
    but this is a problem if the list is long since the user must then
    manually scroll up to the top of the parent page to see the new page.

    Is it possible to scroll the parent window to the top using javascript
    whenever the page in the IFRAME changes?

    Thanks!
    --

    "I hear ma train a comin'
    .... hear freedom comin"
  • RobB

    #2
    Re: iframes and parent window

    Stimp wrote:[color=blue]
    > I have an IFRAME on a webpage with a large height to accommodate a[/color]
    big[color=blue]
    > list output in the frame.
    >
    > If I go down the list and click a row, a new page opens in the[/color]
    IFRAME,[color=blue]
    > but this is a problem if the list is long since the user must then
    > manually scroll up to the top of the parent page to see the new page.
    >
    > Is it possible to scroll the parent window to the top using[/color]
    javascript[color=blue]
    > whenever the page in the IFRAME changes?
    >
    > Thanks!
    > --
    >
    > "I hear ma train a comin'
    > ... hear freedom comin"[/color]

    Might try...

    <script type="text/javascript">

    if (parent) parent.location .hash = '#';

    </script>

    (in the iframe document)

    Comment

    • Stimp

      #3
      Re: iframes and parent window

      On Fri, 11 Feb 2005 RobB <ferndoc9@hotma il.com> wrote:[color=blue]
      > Stimp wrote:
      >
      > Might try...
      >
      ><script type="text/javascript">
      >
      > if (parent) parent.location .hash = '#';
      >
      ></script>
      >
      > (in the iframe document)[/color]

      I tried something like that, putting the function in the <body
      onload> call, but I got a 'permission denied' javascript error.

      The page is .asp, so I wonder does that have any affect on the
      permissions between parent and iframe content?
      --

      "I hear ma train a comin'
      .... hear freedom comin"

      Comment

      • rf

        #4
        Re: iframes and parent window

        "Stimp" <ren@spumco.com > wrote

        [iframed page]

        [color=blue]
        > I tried something like that, putting the function in the <body
        > onload> call, but I got a 'permission denied' javascript error.[/color]
        [color=blue]
        > The page is .asp, so I wonder does that have any affect on the
        > permissions between parent and iframe content?[/color]

        No it does not. The browser knows nothing about asp or any other form of
        server side sripting for that matter.

        You are trying to use javascript across different domains (I assume your
        iframed page is from a different domain to your main page). This is not
        allowed for security reasons.

        --
        Cheers
        Richard.


        Comment

        • Stimp

          #5
          Re: iframes and parent window

          On Sat, 12 Feb 2005 rf <rf@.> wrote:[color=blue]
          > "Stimp" <ren@spumco.com > wrote
          >
          > [iframed page]
          >
          >[color=green]
          >> I tried something like that, putting the function in the <body
          >> onload> call, but I got a 'permission denied' javascript error.[/color]
          >[color=green]
          >> The page is .asp, so I wonder does that have any affect on the
          >> permissions between parent and iframe content?[/color]
          >
          > No it does not. The browser knows nothing about asp or any other form of
          > server side sripting for that matter.
          >
          > You are trying to use javascript across different domains (I assume your
          > iframed page is from a different domain to your main page). This is not
          > allowed for security reasons.[/color]

          aye that would be it... essentially we are creating a system for
          affiliates to our web site where they can include the iframe on their
          own site (different domain obviously) and the iframe will process pages
          from our domain.

          This is only a temporary measure.. ideally we would store the affiliate
          pages on our own server and the affiliate could upload their own header
          and footer for the page.

          Assuming that we can add javascript to both the affiliate's page and the
          iframe content, is there an alternative approach I should look at for
          the problem of scrolling the main page to the top when the iframe
          changes?

          I don't suppose there's something like:

          onIframeChange= 'parent.scroll( 0,0)'

          to detect when the iframe content refreshes?
          --

          "I hear ma train a comin'
          .... hear freedom comin"

          Comment

          • rf

            #6
            Re: iframes and parent window

            "Stimp" <ren@spumco.com > wrote[color=blue]
            > On Sat, 12 Feb 2005 rf <rf@.> wrote:[color=green]
            > > "Stimp" <ren@spumco.com > wrote
            > >
            > > [iframed page][/color][/color]
            [color=blue][color=green]
            > > You are trying to use javascript across different domains (I assume your
            > > iframed page is from a different domain to your main page). This is not
            > > allowed for security reasons.[/color]
            >
            > aye that would be it... essentially we are creating a system for
            > affiliates to our web site where they can include the iframe on their
            > own site (different domain obviously) and the iframe will process pages
            > from our domain.[/color]

            Thought so. Accept that this will not work then.
            [color=blue]
            > This is only a temporary measure.. ideally we would store the affiliate
            > pages on our own server and the affiliate could upload their own header
            > and footer for the page.[/color]

            Better. In the same domain you can do whatever you want.
            [color=blue]
            > Assuming that we can add javascript to both the affiliate's page and the[/color]

            And how would the affiliate feel about you adding stuff to their page? I for
            one would no longer be an "affiliate" .
            [color=blue]
            > I don't suppose there's something like:
            >
            > onIframeChange= 'parent.scroll( 0,0)'
            >
            > to detect when the iframe content refreshes?[/color]

            Sorry, no comment. I don't use iframes and I abhore their use by other
            authors, just like I dont use and abhore frames in general.

            HTH
            --
            Cheers
            Richard.


            Comment

            • phpcode

              #7
              Re: iframes and parent window

              > Sorry, no comment. I don't use iframes and I[color=blue]
              > abhore their use by other
              > authors, just like I dont use and abhore frames
              > in general.[/color]

              Don't abhor frames in general. They do have their use depending on what
              you're doing.

              For example, I created a live chat application using javascript. It could
              never have been possible without iframes.

              On the question of auto scrolling a page to the top, crossdomain scripting
              is just not allowed in javascript. The only way I know of is to have your
              affiliates add the necessary code themselves.

              Comment

              • Stimp

                #8
                Re: iframes and parent window

                On Sun, 13 Feb 2005 phpcode <questions@oasi soflove.com> wrote:[color=blue][color=green]
                >> Sorry, no comment. I don't use iframes and I
                >> abhore their use by other
                >> authors, just like I dont use and abhore frames
                >> in general.[/color]
                >
                > Don't abhor frames in general. They do have their use depending on what
                > you're doing.
                >
                > For example, I created a live chat application using javascript. It could
                > never have been possible without iframes.
                >
                > On the question of auto scrolling a page to the top, crossdomain scripting
                > is just not allowed in javascript. The only way I know of is to have your
                > affiliates add the necessary code themselves.[/color]

                Assuming that they add the code themselves, what code would they need to
                add?

                Cheers.
                --

                "I hear ma train a comin'
                .... hear freedom comin"

                Comment

                • dav sa

                  #9
                  Re: iframes and parent window


                  I too am interested in this. I control two domains and can freely add
                  javascript to both pages. Is there a way for the iframe to tell the
                  parent what its height and width are? I understand the security issue,
                  but shouldn't there be a way form people who obviously own both domains
                  (ie javascript in iframe and parent)?

                  Thank you for your time,
                  David


                  *** Sent via Developersdex http://www.developersdex.com ***
                  Don't just participate in USENET...get rewarded for it!

                  Comment

                  • dav sa

                    #10
                    Re: iframes and parent window



                    I figured this out. In my case, you must put

                    document.domain ="somedomain.co m";
                    this will allow you to use subdomains and different ports. It will
                    not, however, let you use completely differnt domains.
                    ---david

                    *** Sent via Developersdex http://www.developersdex.com ***
                    Don't just participate in USENET...get rewarded for it!

                    Comment

                    Working...