Chrome remembers scroll position

amees_me picture amees_me · Apr 26, 2013 · Viewed 19k times · Source

I'm running into a problem that's actually a "feature" on Chrome. As most of you might know, Chrome remembers a scroll position that it returns to, whenever you come back to a page. And I kind of have a problem with that.

Is there any way to override this without the user noticing?

Mees

Failed try-outs:

  • ScrollTop on document.ready

Answer

Cory Duncan picture Cory Duncan · Jul 8, 2016

In Chrome 46+, the auto scroll behavior can be turned off using history.scrollRestoration:

if ('scrollRestoration' in history) {
  history.scrollRestoration = 'manual';
}

source: https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration