The history object of a browser can be used to switch to history pages such as back and forward from the current page or another page. There are three methods of history object.
- history.back() – It loads the previous page.
- history.forward() – It loads the next page.
- history.go(number) – The number may be positive for forward, negative for backward. It loads the given page number.