Prevent Auto Scrolling on Page Load.

Many modern browsers have a "feature" where the browser remembers where you scrolled to on a previous page load. This browser "feature" will force scroll to that page "scroll position"  on every subsequent visit. This is very frustrating and is usually not the fault of any stack or plugin.

The scroll position is saved in the window's history under scrollRestoration. The scrollRestoration property of History interface allows web applications to explicitly set default scroll restoration behavior on history navigation ( default : auto ). 


How to Stop it?

To prevent this from happening on your web site, add the following snippet of javascriot tot he page head.

<script>
window.history.scrollRestoration = 'manual';
</script>
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk