Browser history is the record a web browser keeps of the pages a user has visited, together with the navigation stack that powers the back and forward buttons in each tab. Among browser technologies on the Web, it serves two distinct purposes: a persistent global history stored in the browser profile, and a per-tab session history that exists only while a tab lives.
The two layers are often confused but follow different rules. Global history feeds address bar suggestions, the history page and visited-link styling, while session history is governed by the HTML Living Standard and exposed to scripts through the History API. Both raise privacy questions, which is why browsers restrict how much of either a web page can observe.
How browsers record and store visits
A browser records a visit whenever a top-level navigation commits, meaning the new document has actually replaced the old one in the tab. It stores the URL, the page title, a timestamp and a transition type that explains how the user arrived, such as typing the address, following a link or reloading. Subresources like images and scripts are not history entries; they belong to the browser cache instead.
Most engines keep global history in a local SQLite database inside the browser profile. Chromium-based browsers use a file named History with separate tables for URLs and individual visits, while Firefox keeps the Places database places.sqlite, which also holds bookmarks. Separating URL records from visit records lets the browser count how often and how recently a page was opened without duplicating data.
The following table summarizes the main fields a typical history store keeps for each entry.
| Field | What it holds | Main use |
|---|---|---|
| URL | Full address of the committed document | Matching and deduplication |
| Title | Text of the page title element | Display in history lists |
| Visit time | Timestamp of each visit | Sorting and retention |
| Visit count | Number of recorded visits | Ranking suggestions |
| Typed count | Visits entered in the address bar | Weighting autocomplete |
| Transition type | Link, typed, reload, redirect or form | Filtering and scoring |
Session history and the History API
Session history is the ordered list of entries in one tab, and moving through it is what the back and forward buttons do. The HTML specification models this as a traversable navigable holding entries for the top-level document and for each iframe, so pressing back can change only an embedded frame. Session history is not saved to the global database by itself, although browsers may persist it for tab and session restore.
Scripts interact with session history through window.history. The methods pushState() and replaceState() add or modify an entry without loading a new document, which is how single-page applications and client-side routing keep URLs meaningful. When the user goes back to such an entry, the page receives a popstate event and must restore the matching view itself. The newer Navigation API offers a single interception point for all navigations and is gradually complementing the older interface.
The table below compares the History API operations most often used in practice.
| Operation | Effect on session history | Loads a document |
|---|---|---|
history.back() | Moves one entry backward | Only if the entry needs it |
history.go(n) | Moves n entries in either direction | Only if the entry needs it |
pushState() | Adds a new entry and drops forward entries | No |
replaceState() | Overwrites the current entry | No |
popstate event | Signals traversal to a same-document entry | No |
A security rule constrains these methods: pushState() accepts only same-origin URLs, so a script cannot make the address bar display another site. This restriction follows the broader same-origin policy and prevents a cheap form of phishing.
How history powers address bar suggestions
Global history is the main input for address bar autocomplete, and each engine ranks candidates with its own scoring model. Firefox uses frecency, a combined measure of frequency and recency that weights typed visits and bookmarks more heavily and decays older visits. Chromium computes relevance scores in its omnibox providers, where typed URLs and exact host matches usually outrank pages reached through ordinary links.
The same records drive related features: visited-link styling through the :visited pseudo-class, new-tab page tiles of frequently opened sites, and history search. Because these features read the same database, clearing history affects all of them at once, which surprises users who only wanted to remove one suggestion.
Privacy protections and history leakage
Browser history is sensitive personal data, because a list of visited pages can reveal health, financial or political interests. For years, sites could detect visited links by reading the computed color of a link, a technique called history sniffing. Browsers responded by restricting `:visited` styles to a few color properties and lying to scripts that query them, and engines are now moving toward partitioned visited links keyed to the site where the link appears.
Several mechanisms limit what history records or exposes. The table below compares them by scope and persistence.
| Mechanism | What it changes | Persistence |
|---|---|---|
| Private browsing | No global history written for the session | Discarded when the window closes |
| Automatic retention limit | Old visits deleted after a set period | Ongoing |
| Manual clearing | Selected time range removed from the profile | Permanent on that device |
| Visited-link restrictions | Scripts cannot read visited state | Built into the engine |
| History sync | Entries copied to other devices of the account | Stored by the sync service |
A frequent misconception is that clearing local history erases every trace of browsing. It does not affect server logs, DNS resolver records, network monitoring by an employer or account-level activity records kept by search engines and other services. Private browsing is likewise local protection only and does not hide traffic from the network.
Retention, sync and practical limits
Retention policies differ by engine and are not fixed forever. Chromium has long deleted visits older than about 90 days by default, while Firefox removes entries based on database size and frecency rather than a single age limit. Synced history can outlive local deletion if the user does not also clear it in the account settings, so administrators should check both places.
Developers meet a separate set of limits in session history. The table maps common symptoms to their usual causes.
| Symptom | Likely cause | Typical fix |
|---|---|---|
| Back button leaves the app | Views changed without pushState() | Push an entry per meaningful view |
| Back requires many presses | Entry pushed for every minor state change | Use replaceState() for minor changes |
| Blank view after going back | No popstate handler restores state | Rebuild the view from the stored state |
| Stale page after back navigation | Page restored from the back/forward cache | Listen for the pageshow event |
The back/forward cache deserves a separate note: browsers may keep a whole page frozen in memory so that going back is instant. Pages that hold open connections or register an unload handler can become ineligible for this cache, which makes back navigation noticeably slower.
The short version
Browser history is your browser’s memory of where you have been. It keeps a long-term list of visited pages so you can find them again and so the address bar can guess what you want to type.
Each tab also has a short-term trail of pages, like breadcrumbs, which the back and forward buttons follow. Clearing your history removes the list from your device, but it does not erase records kept elsewhere, such as on the websites you visited.
Where it makes a difference
A team building an online store as a single-page application received complaints that pressing back on a product page threw shoppers out of the site entirely. The cause was that filters and product views changed without new history entries, so the only entry behind the current one was the search engine results page.
The developers pushed one entry per product and per category with pushState(), but used replaceState() for minor filter tweaks such as sorting order, so a single back press would not step through twenty small adjustments. They also added a popstate handler that restored the scroll position and filters stored in the entry state. After the change, the back button behaved like it does on a traditional multi-page site, and support tickets about lost navigation stopped.