Search code examples
iframeloadscrollscrolltop

How to prevent page from scrolling to an iframe on load?


I have an iframe in my page and when I load the page, the page scrolls to the start on the iframe which is about 200px from the top of the page. If I change the iframe to a div then the page loading is as normal, meaning the page is scrolled to the top. So it is something about the iframe that is causing this.

Does anyone know how to prevent this from happening?


Solution

  • Sorry, this was a dumb question. I just set the style property to display:none; and that solved it.