How can I ensure that when updating a Webflow page, the scrolling always starts from the beginning?

TL;DR
  • Ensure your page reloads instead of caching, and insert window.onbeforeunload = function () { window.scrollTo(0, 0); }; in the Webflow project settings under "Before Body Tag".
  • Publish the changes and test in various browsers to confirm the page resets to the top on reload for all users and devices.

To ensure that your Webflow page always starts scrolling from the beginning upon updating or reloading, follow these steps:

1. Check for Page Reload Requirements

  • Reload: Make sure that your page is set to reload rather than cache, which may cause users to return to their previous scroll position.

2. Use JavaScript for Scroll Reset

  • Custom Code: Implement a small JavaScript snippet in your Webflow project to reset the scroll position upon page load.

3. Insert Custom Code in Project Settings

  • Go to Project Settings: Navigate to the Custom Code section of your Webflow project.
  • Add to Head or Body: Insert the following JavaScript snippet before the closing </body> tag in the Before Body Tag section:
  • window.onbeforeunload = function () { window.scrollTo(0, 0); };
  • Publish Changes: Save the changes and publish your site to apply the scroll reset functionality.

4. Preview and Test

  • Check in Different Browsers: Open your page in various browsers to ensure that the scroll position resets as expected.
  • Compare Behaviors: Ensure that mobile devices restart at the top as desired, akin to desktop behavior.

Summary

To make sure your Webflow page always starts from the top when reloaded, insert a small JavaScript snippet in the Project Settings under "Before Body Tag". This ensures the page resets to scroll position 0, 0 on reload for all users and devices.

Rate this answer

Other Webflow Questions