htmx:after:history:update
Fires after browser history update
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”) andpath -
sourceElement- Element that triggered the navigation -
response- 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.
Licensed under the Zero-Clause BSD License.
https://four.htmx.org/reference/events/htmx-after-history-update/