Preserving scroll position

Is there a way of preserving scroll position whenever clicking back and forth between pages? Meaning i’m for instance halfway down a page, click onto a new page at the nav bar at the top, and keeping my position halfway down the page when clicking return? Im currently on the free plan, and havent found a way do to this.

you can store the current scrollposition in a local storage before changing the page.

this would look like this:

< script>

  setTimeout(function() {

   $(window).unload(function() {
      var scrollPosition = $(".content-scroll-wrapper").scrollTop();
      localStorage.setItem("scrollPosition", scrollPosition);
   });
  
   if(localStorage.scrollPosition) {
      $(".content-scroll-wrapper").scrollTop(localStorage.getItem("scrollPosition"));
   }

  }, 1000); 
  
  
  
< /script>

(erase the blank characters inside the “script” brackets)