javascript - Make browser go to top of page when reloading page -


i've made simple html page. when press reload icon in browser (safari mac, chrome mac, safari ios), page reloads, , retains vertical position in page.

  1. is default behaviour in browsers these days? seem remember browsers used go top of page before (at least years back). when did change?

  2. what best way make browser go top of page when page reloaded? hook "on document load", , jump anchor @ top?

use window.scrollto(0,0) on document load

edit 1:

something should trick:

document.onload = function(){   window.scrollto(0,0); } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -