title: Vanilla JavaScript: Scroll to Top of Page
body: <p>I may have missed something, but I cannot get <code>window.scrollTo(0,0)</code> to move to the top of the page.</p>
  
  <p>I am implementing a sticky <code>aside</code> which works well enough. It uses <code>.getBoundingClientRect()</code> to get the initial position.</p>
  
  <p>However, if the page is partly scrolled, and I refresh the page, it reads the position wrongly, and is positioned in the wrong place.</p>
  
  <p>I though I would fix this by executing <code>window.scrollTo(0,0)</code> at the beginning, so that the page is at the top, and the <code>aside</code> is in the right position.</p>
  
  <p>When I run the code, <code>window.scrollTo(0,0)</code> doesn’t seem to make any difference.</p>
  
  <p>What is the correct way to get the reloaded window to start at the top?</p>
  
  <p>I have tested it on Firefox on the Mac. Chrome and Safari gives a similar behaviour.</p>
  
  <p>Please, no jQuery.</p>