htmx/www/headers/hx-replace-url.md
Daniel J. Summers 8e43f32019
Add docs for HX-Replace-Url header (#972)
- Fix links on hx-replace-url attribute page
- Sort headers alphabetically on reference page
2022-07-20 06:46:46 -06:00

923 B
Raw Blame History

layout title
layout.njk </> htmx - HX-Replace-Url Response Headers

HX-Replace-Url Response Header

The HX-Replace-Url header allows you to replace the current URL in the browser location history. This does not create a new history entry; in effect, it removes the previous current URL from the browsers history. This is similar to the hx-replace-url attribute.

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

The possible values for this header are:

  1. A URL to replace the current URL in the location bar. This may be relative or absolute, as per history.replaceState(), but must have the same origin as the current URL.
  2. false, which prevents the browsers current URL from being updated.