## TL;DR
The History API (`window.history`) enables single-page applications to manipulate the browser session history — adding entries, replacing states, and navigating without full page reloads. It is the foundation of client-side routing in SPAs.
## Core Explanation
`history.pushState(state, title, url)` adds a new entry. `history.replaceState()` modifies the current entry without creating a new one. `popstate` event fires on back/forward navigation. State objects are serialized (structured clone) — up to ~640KB in practice. The URL must be same-origin. Browser history entries are not directly readable — only via `history.length` and `history.state`.
## Further Reading
- [HTML Standard — Session History and Navigation](https://html.spec.whatwg.org/multipage/history.html)