Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026
The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.
This event is called on window every time the active history state changes, with the current state as the callback parameter:
window.onpopstate = event => {
console.log(event.state)
}
or
window.addEventListener('popstate', event => {
console.log(event.state)
})
will log the new state object (the first parameter passed to pushState or replaceState) every time you call history.back(), history.forward() or history.go().