Spec-Zone.ru › htmx

HX-Redirect

Redirects by setting location.href

The HX-Redirect response header redirects to a new URL with a full page reload.

Use it for non-htmx endpoints or pages that require a full browser load.

For AJAX navigation inside an htmx application, use HX-Location.

Response headers are not processed on 3xx response codes. Return a 2xx status when using this header.

Example

HX-Redirect: /dashboard
return Response(
    "Redirecting...",
    headers={'HX-Redirect': '/dashboard'}
)

See Also

  • HX-Location

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

Spec-Zone.ru

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