I have page refresh code in the head of my page. That part works well. But if the user is scrolled down on the page, when the refresh hits, the page scrolls to the top. I want to prevent the scroll up, leave the page alone, just do the refresh and no scrolling
This is what I have tried
<script>
window.onload = setupRefresh;
function setupRefresh() {
setTimeout("refreshPage();", 2000); // milliseconds
}
function refreshPage() {
window.location = location.href;
}
</script>
<script>
if ('scrollRestoration' in history) {
history.scrollRestoration = 'manual';
}
</script>