The scrollRestoration
property of History
interface allows web applications to explicitly set default scroll restoration behavior on history navigation.
The scrollRestoration
property of History
interface allows web applications to explicitly set default scroll restoration behavior on history navigation.
One of the following:
js
const scrollRestoration = history.scrollRestoration; if (scrollRestoration === "manual") { console.log( "The location on the page is not restored, user will need to scroll manually.", ); }
js
if (history.scrollRestoration) { history.scrollRestoration = "manual"; }
Specification |
---|
HTML Standard # dom-history-scroll-restoration-dev |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
scrollRestoration |
46 | 79 | 46 | No | 33 | 11 | 46 | 46 | 46 | 33 | 11 | 5.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/History/scrollRestoration