JavaScript: History Object

javascript history object

History object:

console.log(window.history);
result of logging window.history

History Properties:

auto: when you set it to “auto”, the location on the page to which the user has scrolled will be restored.

manual: when you set it to “manual”, the user will have to scroll to the location manually

History Methods:

histoy.back();    ===    history.go(-1);
history.forward(); === history.do(1);
history.go(); === history.go(0) // it reloads current page

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store