Back
You can use the below code for onload:
// This prevents the page from scrolling down to where it was previously.if ('scrollRestoration' in history) { history.scrollRestoration = 'manual';}// This is needed if the user scrolls down during page load and you want to make sure the page is scrolled to the top once it's fully loaded. This has Cross-browser support.window.scrollTo(0,0);
// This prevents the page from scrolling down to where it was previously.
if ('scrollRestoration' in history) {
history.scrollRestoration = 'manual';
}
// This is needed if the user scrolls down during page load and you want to make sure the page is scrolled to the top once it's fully loaded. This has Cross-browser support.
window.scrollTo(0,0);
I hope this will help.
Want to become a Java Expert? Join Java Course now!!
Want to know more about Java? Watch this video on Java Course | Java Tutorial for Beginners:
31k questions
32.8k answers
501 comments
693 users