It’s default feature of browser that it saves scroll history. Suppose you scroll half window, now refresh browser will load from the half window. But sometimes we need a custom arrangement for this behavior of browser and disable this scroll history. To manipulate history of browser there is history api. Also, there is a blog post in google developer blog to clear this. Mozila firefox’s MDN web docs says this is experimental feature in firefox now , see the doc here.
I found two polyfill that helps to make this work in all most all modern browser except IE Edge.
- https://github.com/bfred-it/scroll-restoration-polyfill
- https://github.com/brigade/delayed-scroll-restoration-polyfill
Just include the polyfil and override the history restore behavior of browser
https://gist.github.com/manchumahara/1d0ea8468d53ef0a6e524b93e1ccc56a