htmx/www/content/headers/hx-push-url.md
William Jackson efcc6b2211
Add descriptions for /headers/* and /api (#3221)
* Add descriptions for /headers/* and /api

* Add a missing space in a description
2025-03-05 20:58:38 -07:00

982 B
Raw Blame History

+++ title = "HX-Push-Url Response Header" description = """
Use the HX-Push-Url response header in htmx to push a URL into the browser location history.""" +++

The HX-Push-Url header allows you to push a URL into the browser location history. This creates a new history entry, allowing navigation with the browsers back and forward buttons. This is similar to the hx-push-url attribute.

If present, this header overrides any behavior defined with attributes.

The possible values for this header are:

  1. A URL to be pushed into the location bar. This may be relative or absolute, as per history.pushState().
  2. false, which prevents the browsers history from being updated.

Notes

Response headers are not processed on 3xx response codes. see Response Headers