Loading

Quipoin Menu

Learn • Practice • Grow

java-script / History Object
interview

Q1. What is the history object?
The History Object is a browser object that allows JavaScript to interact with the browser’s session history.
It enables navigation through previously visited web pages in the same browser tab, such as moving forward or backward in history.


Q2. Where does the History Object belong?
The History Object is part of the Browser Object Model (BOM).
It can be accessed using the window.history property. Since window is the global object, it can also be accessed directly as history.


Q3. What does history.back() do?
The history.back() method loads the previous page in the browser history.

Example
history.back();

It works the same as clicking the browser’s back button.


Q4. What does history.forward() do?
The history.forward() method loads the next page in the browser history.

Example
history.forward();

It works the same as clicking the browser’s forward button.


Q5. What is history.go() method?
The history.go() method loads a specific page from the session history.
It accepts positive, negative, or zero values.

Example
history.go(-1); // Moves one step back
history.go(1);  // Moves one step forward
history.go(0);  // Reloads current page