How to let the chrome forget the page scroll position? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to let the chrome forget the page scroll position? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

For instance, I open a web page, and scroll down to some position,

then I refresh the chrome browser, the browser could scroll the previous position again

How can I use javascript or css to let the browser to forget the scroll?

I have try $(window).scrollTop(0), but it doesn’t work

Answer

A simple way that I can say is to run this code on page load:

document.location = "#";

OR

window.scrollTo(0);

It set the browser viewport to the top of the page, again.

We are here to answer your question about How to let the chrome forget the page scroll position? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji