mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-28 13:31:06 +00:00
include HX-History-Restore-Request
header in history restore requests
This commit is contained in:
parent
d71a4b086f
commit
edbbaee638
@ -11,6 +11,8 @@
|
||||
JSON or javascript via the `javascript:` prefix
|
||||
* `hx-include` will now include all inputs under an element, even if that element is not a form tag
|
||||
* The [preload extension](https://htmx.org/extensions/preload/) now offers a `preload-images="true"` attribute that will aggressively load images in preloaded content
|
||||
* On requests driven by a history cache miss, the new `HX-History-Restore-Request` header is included so that the server
|
||||
can differentiate between history requests and normal requests
|
||||
|
||||
### Improvements & Bug fixes
|
||||
|
||||
|
@ -1468,6 +1468,7 @@ return (function () {
|
||||
var details = {path: path, xhr:request};
|
||||
triggerEvent(getDocument().body, "htmx:historyCacheMiss", details);
|
||||
request.open('GET', path, true);
|
||||
request.setRequestHeader("HX-History-Restore-Request", "true");
|
||||
request.onload = function () {
|
||||
if (this.status >= 200 && this.status < 400) {
|
||||
triggerEvent(getDocument().body, "htmx:historyCacheMissLoad", details);
|
||||
|
@ -70,6 +70,7 @@ title: </> htmx - Attributes
|
||||
| Header | Description |
|
||||
|-------|-------------|
|
||||
| `HX-Current-URL` | the current URL of the browser
|
||||
| `HX-History-Restore-Request` | `true` if the request is for history restoration after a miss in the local history cache
|
||||
| `HX-Prompt` | the user response to an [hx-prompt](/attributes/hx-prompt)
|
||||
| `HX-Request` | always `true`
|
||||
| `HX-Target` | the `id` of the target element if it exists
|
||||
|
Loading…
x
Reference in New Issue
Block a user