HX-Replace-Url 响应标头

HX-Replace-Url 标头允许你替换浏览器 位置历史记录 中的当前 URL。这不会创建新的历史记录条目;实际上,它会从浏览器的历史记录中删除以前的当前 URL。这类似于 hx-replace-url 属性

¥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 browser’s 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. 要替换位置栏中当前 URL 的 URL。根据 history.replaceState(),这可能是相对的或绝对的,但必须与当前 URL 具有相同的来源。

    ¥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,阻止浏览器的当前 URL 更新。

    ¥false, which prevents the browser’s current URL from being updated.

注释

¥Notes

3xx 响应代码不会处理响应标头。参见 响应标头

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