Debian Codegraph @

www/src/content/reference/03-events/21-htmx-after-replace-into-history.md

raw symbols SCIP
1 ---
2 title: "htmx:after:history:replace"
3 description: "After a replace state action"
4 ---
5
6 The `htmx:after:history:replace` event fires specifically after a `history.replaceState()` operation (replaces current history entry).
7
8 ## When It Fires
9
10 After the current history entry is replaced, without creating a new back button entry.
11
12 ## Event Detail
13
14 - `path` - The path that replaced the current history entry
15
16 ## Example
17
18 ```javascript
19 htmx.on('htmx:after:history:replace', (evt) => {
20 console.log('Replaced history with:', evt.detail.path);
21 });
22 ```
23
24 This modifies the current history entry without affecting the back button.