🕓 History Object
Last Updated: 26th October 2025
The History Object allows you to access and control the browser's session history (the list of pages visited in the current tab).
It is part of the BOM (Browser Object Model) and helps you navigate backward or forward between visited pages.
Hinglish Tip 🗣: history object browser ke “Back” aur “Forward” button ka JavaScript version hai!
Common Properties
Common Methods
Example
console.log("History Length:", history.length);
// Go back one page
// history.back();
// Go forward one page
// history.forward();
// Go back two pages
// history.go(-2);
// Add new entry in history without reload
history.pushState({ user: "John" }, "User Page", "/user");
// Replace current entry
history.replaceState({ page: "home" }, "Home Page", "/home");
