javascript - location.hash in an iframe scrolls the parent window -


I have an iframe page that has code inside iframe (which i can not change) which iframe to location.hash Sets in the id of an element in the window.

This has an unwanted effect of scrolling out my external browser window so that it touches the top of the iframe above the window, it is very upset because I have a toolbar above the IFrame which is important for my app.

Does any main way of stopping the location window affect the scroll position of the main window?

What will stop? Do you have to help me get out of here?

Edit: It seems that it is not really possible to have the way I described it.

If preventDefault does not do what you want, you can do it dynamic By form & lt; A name = 'iframehash' & gt; so that it always remains at the top of the screen. In this way, whenever the call goes to hash, he says, nothing will really work.

But if preventDefault () works, then this is a better solution.


Comments