Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 993889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:29:39+00:00 2026-05-16T06:29:39+00:00

I have the following embedded iframe <iframe width=100% height=400 src=reallylongpage.html /> reallylongpage.html has 2

  • 0

I have the following embedded iframe

<iframe width="100%" height="400" src="reallylongpage.html" />

reallylongpage.html has 2 anchors #top and #bottom

I want my iframe to load reallylongpage.html at the bottom of the page so I did

<iframe width="100%" height="400" src="reallylongpage.html#bottom" />

But this has the undesirable effect of scrolling both the iframe AND the parent page. The parent page shouldn’t scroll at all. This happens in Chrome and Firefox.

here is an example with full code

parent.html

<html>
 <body>
    <div style="padding:100 200;">
      <iframe WIDTH="100%" HEIGHT="400" SRC="CHILD.HTML#BOTTOM" ></iframe>
    </div>
    <div>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br>11<br>12<br>13<br>14<br>15<br>16<br>17<br>18<br>19<br>20<br>21<br>22<br>23<br>24<br>25<br>26<br>27<br>28<br>29<br>30<br></div>
 </body>
</html>

child.html

<html>
  <body>
    <a name="top" href="#bottom">go to bottom</a><br>
    1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br>11<br>12<br>13<br>14<br>15<br>16<br>17<br>18<br>19<br>20<br>21<br>22<br>23<br>24<br>25<br>26<br>27<br>28<br>29<br>30<br>
    <a name="bottom" href="#top">go to top</a>
 </body>
</html>

this is what i want it to look like
correct

this is what i get instead
incorrect

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:29:39+00:00Added an answer on May 16, 2026 at 6:29 am

    This appears to be the de facto behavior in browsers (At least I couldn’t find any written standard about anchors and scrolling).

    The browser tries its best to scroll all windows until the desired fragment is visible. (You’ll notice this even when you click on the “got to top” link and also if you add “padding-bottom: 3000px;” to the div in your example.)

    Consider using jQuery’s scrollTo plugin which actually manipulates scroll position of the appropriate container for you.

    To demonstrate with your own example:

    Hosted Demos:

    With jQuery scrollTo

    Without jQuery scrollTo

    Full Source:

    parent.html

    <!doctype html>
    <html>
        <head>
            <title>parent</title>
            <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
            <script type="text/javascript" src="jquery.scrollTo-min.js"></script>
            <script type="text/javascript">
                $(function(){
                    var iframe = $('iframe');
                    iframe.load(function(){
                        iframe.scrollTo('a[name=bottom]');
                    });
                });
            </script>
        </head>
        <body>
            <div style="padding:100px 200px 3000px;">
                <iframe width="100%" height="400" src="child.html"></iframe>
            </div>
            <div>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br>11<br>12<br>13<br>14<br>15<br>16<br>17<br>18<br>19<br>20<br>21<br>22<br>23<br>24<br>25<br>26<br>27<br>28<br>29<br>30<br></div>
        </body>
    </html>
    

    child.html

    <!doctype html>
    <html>
        <head>
            <title>child</title>
            <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
            <script type="text/javascript" src="jquery.scrollTo-min.js"></script>
            <script type="text/javascript">
                $(function(){
                    $('a').click(function(){
                        $(window).scrollTo('a[name=' + this.hash.substring(1) + ']');
                        return false;
                    });
                });
            </script>
        </head>
        <body>
            <a name="top" href="#bottom">go to bottom</a><br>
            1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br>11<br>12<br>13<br>14<br>15<br>16<br>17<br>18<br>19<br>20<br>21<br>22<br>23<br>24<br>25<br>26<br>27<br>28<br>29<br>30<br>
            <a name="bottom" href="#top">go to top</a>
     </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 498k
  • Answers 498k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The mail server is returning an error when you try… May 16, 2026 at 12:11 pm
  • Editorial Team
    Editorial Team added an answer Let's try to get best performace. if n is number… May 16, 2026 at 12:11 pm
  • Editorial Team
    Editorial Team added an answer Yes, it is. I don't see any downside, except maybe… May 16, 2026 at 12:10 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have following page <html> <head> <script type=text/javascript src=e01.js></script> </head> <body> <script type=text/javascript> var
I have a .jsp that contains an IFrame with a page that has some
I have the following code snippet embedded into some of my divs so when
I have the following c# code embedded in a literal <% %> of a
I have following problem. In my view model I defined some list properties as
I expect to see a nil returned with the following embedded Ruby: <%=h [@inventory.origin.code]
Have following setup: MainActivity class - extends activity MyLayout class - extends View Prefs
I have following string: <div> text0 </div> prefix <div> text1 <strong>text2</strong> text3 </div> text4
I have following regex (abc|def)( ?(\\d+|(?:(?!\\1)[a-z])+)?)* with matches perfectly the subject abc123 456 .
currently I have following code: home.php <form name='myformname' id='myformid'> <input type='text' name='mytext1' value='abc'> <input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.