Force page scroll position to top at page refresh in HTML

For a simple plain JavaScript implementation:

window.onbeforeunload = function () {
  window.scrollTo(0, 0);
}

Leave a Comment