Page 1 of 1

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

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

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.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.




RSS Feed

Home Forums Web Development JavaScript – How to scroll the parent page to top after frame reload

This topic contains 1 reply, has 2 voices, and was last updated by  qigigype 8 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • 8519

    hans
    Keymaster

    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.

    10994

    qigigype
    Participant

    Thanks! I’ll save myself for the future

Viewing 2 posts - 1 through 2 (of 2 total)



You must be logged in to reply to this topic.