History API restores back button behavior in SPAs
A single page shop swaps products without reloads, then its Back button jumps somewhere unexpected.
I push a history entry for each view so Back returns to the previous rendered state.
MDN shows pushState fixing SPA navigation by synthesizing entries the browser can traverse.
The popstate event fires when the active entry changes, letting scripts rerender the matching view.
State travels inside the entry object, so reloads and shares need separately designed fallbacks.
If fetch() treats network as promises with explicit control loads the data, DOM turns documents into scriptable objects renders it without a reload.
I pair every content swap with a history entry whenever Back must keep working.