The scrollRestoration property of the History interface allows web applications to explicitly set default scroll restoration behavior on history navigation.
One of the following:
autoThe location on the page to which the user has scrolled will be restored.
manualThe location on the page is not restored. The user will have to scroll to the location manually.
const scrollRestoration = history.scrollRestoration;
if (scrollRestoration === "manual") {
console.log(
"The location on the page is not restored, user will need to scroll manually.",
);
}history.scrollRestoration = "manual";