Spec-Zone.ru › htmx

HX-History-Restore-Request

Indicates history navigation (back/forward)

The HX-History-Restore-Request request header is set to true when the user navigates back or forward in history.

htmx restores the previous state without a full page reload. Use this to skip side effects during history restoration.

Example

Skip analytics for restored pages.

if request.headers.get('HX-History-Restore-Request'):
    # Don't log analytics or run side effects
    return render_content()
else:
    log_page_view()
    return render_content()

Licensed under the Zero-Clause BSD License.
https://four.htmx.org/reference/headers/HX-History-Restore-Request/

Spec-Zone.ru

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