Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is most likely no translated for the post!





Share:
Notifications
Clear all

JavaScript - How to scroll the parent page to top after frame reload  

  RSS

Hans
 Hans
(@hans)
Noble Member Admin
Joined: 7 years ago
Posts: 1437
July 18, 2017 9:48 AM  

So there are several tricks out there for the following situation, and the one below was the easiest and simplest to implement.

If you have a main page (the parent) with an iframe in it, and you want that page to scroll to the top when the iframe reloads, simply try using the onload event for the iframe as such:

<iframe src="whicheverfile.html" onload="scroll(0,0);"></iframe>

Whenever the content of the iframe refreshes/reloads, the parent page will scroll to the top.


ReplyQuote
qigigype
(@qigigype)
New Member
Joined: 2 years ago
Posts: 1
October 12, 2018 5:49 AM  

Thanks! I'll save myself for the future


ReplyQuote
Share: