| 1 | --- |
| 2 | title: "htmx:after:history:push" |
| 3 | description: "After a push state action" |
| 4 | --- |
| 5 | |
| 6 | The `htmx:after:history:push` event fires specifically after a `history.pushState()` operation (creates new history entry). |
| 7 | |
| 8 | ## When It Fires |
| 9 | |
| 10 | After a new history entry is pushed, allowing forward/back navigation to this point. |
| 11 | |
| 12 | ## Event Detail |
| 13 | |
| 14 | - `path` - The path that was pushed into history |
| 15 | |
| 16 | ## Example |
| 17 | |
| 18 | ```javascript |
| 19 | htmx.on('htmx:after:history:push', (evt) => { |
| 20 | console.log('Pushed to history:', evt.detail.path); |
| 21 | // Track navigation in analytics |
| 22 | }); |
| 23 | ``` |
| 24 | |
| 25 | This creates a new entry in the browser's history stack. |