htmx:after:history:replace
Fires after history replacement
The htmx:after:history:replace event fires specifically after a history.replaceState() operation (replaces current history entry).
When It Fires
After the current history entry is replaced, without creating a new back button entry.
Event Detail
-
path- The path that replaced the current history entry
Example
htmx.on('htmx:after:history:replace', (evt) => {
console.log('Replaced history with:', evt.detail.path);
}); This modifies the current history entry without affecting the back button.
Licensed under the Zero-Clause BSD License.
https://four.htmx.org/reference/events/htmx-after-replace-into-history/