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 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
child.html