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 no translation for that post!



JavaScript - How to...
 
Share:
Notifications
Clear all

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

2 Posts
2 Users
0 Reactions
4,184 Views
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
Topic starter  

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)
New Member
Joined: 7 years ago
Posts: 1
 

Thanks! I'll save myself for the future


   
ReplyQuote
Share: