KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
When a page loads an iframe with a url ending in a #, the parent page scrolls so that the iframe's body is at the top of the browser window. Demo: http://jsfiddle.net/dTQEE/1/ If the URL ends in # , e.g. http://foo.com# , the browser assumes you want to go to the top of the page. How do you prevent the parent window from scrolling when an iframe with a hash fragment is loaded? Problem happens in Chrome, not sure if it's an issue in other browsers. Right now the best solution I have is to use el.addEventListener('scroll', ...) to reset the scrollTop to 0 if it's not already 0. This works, but the scroll down and the scroll up are both very noticeable.
Tags (comma-separated)
Save Edits
Cancel