The htmx:after:history:update event fires after htmx has updated the browser history state.
When It Fires
After history.pushState() or history.replaceState() completes.
Event Detail
history- Object withtype(“push” or “replace”) andpathsourceElement- Element that triggered the navigationresponse- Response object
Example
htmx.on('htmx:after:history:update', (evt) => { console.log('History updated to:', evt.detail.history.path); // Update analytics, breadcrumbs, etc. });
The URL bar now reflects the new path.