Spec-Zone.ru › htmx

htmx:before:history:update

Fires before browser history update

The htmx:before:history:update event fires before htmx pushes or replaces a browser history state.

When It Fires

Before history.pushState() or history.replaceState() is called.

Event Detail

  • history - Object with type (“push” or “replace”) and path
  • sourceElement - Element that triggered the navigation
  • response - Response object

Example

htmx.on('htmx:before:history:update', (evt) => {
  console.log('Updating history:', evt.detail.history.type, evt.detail.history.path);
  // Modify path or cancel history update
});

Cancel this event to prevent the history update.

Licensed under the Zero-Clause BSD License.
https://four.htmx.org/reference/events/htmx-before-history-update/

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API