Reputation: 13141
I have to scroll up in a page. Therefore I put a an anchor at the correct place and then I did
window.location.href = 'http://example.org/#anchor';
This works fine with FF, Chrome, Safari and IE9. But in IE8 nothing happens (it does not scroll).
I also tried:
window.location.hash = "anchor";
window.location.hash = "#anchor";
scrollTo(0, 0);
However, IE8 just does not want to scroll. It is important that we move the focus to the anchor. A reloading is not possible.
Thanks in advance for any tipps :)
Upvotes: 0
Views: 8654
Reputation: 25493
For IE 8 just use it like this, it will work:
window.location = 'http://example.org/#anchor';
Hope this helps.
Upvotes: 7