How to let the chrome forget the page scroll position?


Tags: javascript,css,google-chrome,scroll

Problem :

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



Solution :

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.


    CSS Howto..

    Finding correct CSS sheet when Chrome Inspector shows (index) [closed]

    How to detect CSS inheritance source?

    How can I handle XML namespaces in CSS Selectors or in jQuery?

    How to embed a font in website

    How browser renders HTML

    How do you style TextFlow with CSS Styles in Flex 4.5.1?

    How do you make an image or button glow when you mouse over using javascript or jquery?

    How do I get this HTML canvas animation to appear on top of my image?

    How to change an input button with pure css button (no images)? [duplicate]

    How to set font style light?

    How to apply CSS directives to h3 element?

    How to do onclick in CSS to do transition on image?

    how to hide and show a div that is inside of a form using only javascript and css

    How to use z-index to make an element overlap another element in CSS

    How to make cross-browser compatibility with IE10 and IE11?

    how to underline a letter of button caption in vaadin?

    How do I use a sprite background image to display once on an element (no-repeat)?

    how to indent HTML forms on modals [closed]

    CSS How to use margins with different divs

    How does Slick js carousel behave width custom css?

    HTML or CSS, how is this done? [closed]

    How to apply CSS after adding elemnts with jquery

    How to make a HTML5 font lighter when fontWeight doesn't work? [closed]

    How to add content to an input with css? [duplicate]

    How do I prevent the element of an HTML5 form from moving slightly?

    version control: how to control css and js compressed/minified versions between environments

    How can change the style of
      tag in CSS

    How to change css style value using php in a for loop?

    How to set css class to div area of ckeditor

    show play icon on image hover