Web Designer in Hastings

Coding: iframes


Force scroll to top

A common problem when browsing through multiple pages from within an iframe is that all subsequent pages appear at the same scroll position. It is usually more desirable for the pages start back at their top scroll position.

You can force the framed page to scroll to its top by including this code in the framed page's head content:

<body onload="self.scrollTo(0,0)">

or to force the page to scroll to the top of the parent page by inserting the following code in the framed page's head content:

<body onload="top.scrollTo(0,0)">


start iframe at top