History: scrollRestoration property
        
        
          
                Baseline
                
                  Widely available
                
                
              
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
The scrollRestoration property of the History
interface allows web applications to explicitly set default scroll restoration behavior
on history navigation.
Value
One of the following:
Examples
>Query the current scroll restoration behavior
js
const scrollRestoration = history.scrollRestoration;
if (scrollRestoration === "manual") {
  console.log(
    "The location on the page is not restored, user will need to scroll manually.",
  );
}
Prevent automatic page location restoration
js
history.scrollRestoration = "manual";
Specifications
| Specification | 
|---|
| HTML> # dom-history-scroll-restoration-dev>  | 
            
Browser compatibility
Loading…