Scroll Iframe to the top of the page

From Booking Automation Wiki
Jump to: navigation, search
This page explains how to scroll an iframe to the top of the page

Requires: Knowledge of HTML, Javascript

When a long page inside an iframe changes to a shorter page, the guest viewing the page might be left at the bottom looking at what appears to be a blank page. Possibilities to access and control the Iframe from outside (your website) are limited. What you could do:

  • Add onload="window.parent.parent.scrollTo(0,0)" to the Iframe. For example:

<iframe onload="window.parent.parent.scrollTo(0,0)" style="max-width: 100%; border: none; overflow: auto;" src="" height="1500" width="800"></iframe>

  • Reduce the height of the embedded booking page or the iframe. Keeping the iframe small and allowing scroll bars to navigate inside it can work well.
  • Web developers can create a custom landing page after the booking. The setting is SETTINGS -> BOOKING PAGE -> PAGE DESIGN -> BEHAVIOUR "Booking Return URL". Information about the booking is passed to your page as URL parameters which you could extract and display on your page.