mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-30 22:41:23 +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
|
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
|
* `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
|
* 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
|
### Improvements & Bug fixes
|
||||||
|
|
||||||
|
@ -1468,6 +1468,7 @@ return (function () {
|
|||||||
var details = {path: path, xhr:request};
|
var details = {path: path, xhr:request};
|
||||||
triggerEvent(getDocument().body, "htmx:historyCacheMiss", details);
|
triggerEvent(getDocument().body, "htmx:historyCacheMiss", details);
|
||||||
request.open('GET', path, true);
|
request.open('GET', path, true);
|
||||||
|
request.setRequestHeader("HX-History-Restore-Request", "true");
|
||||||
request.onload = function () {
|
request.onload = function () {
|
||||||
if (this.status >= 200 && this.status < 400) {
|
if (this.status >= 200 && this.status < 400) {
|
||||||
triggerEvent(getDocument().body, "htmx:historyCacheMissLoad", details);
|
triggerEvent(getDocument().body, "htmx:historyCacheMissLoad", details);
|
||||||
|
@ -70,6 +70,7 @@ title: </> htmx - Attributes
|
|||||||
| Header | Description |
|
| Header | Description |
|
||||||
|-------|-------------|
|
|-------|-------------|
|
||||||
| `HX-Current-URL` | the current URL of the browser
|
| `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-Prompt` | the user response to an [hx-prompt](/attributes/hx-prompt)
|
||||||
| `HX-Request` | always `true`
|
| `HX-Request` | always `true`
|
||||||
| `HX-Target` | the `id` of the target element if it exists
|
| `HX-Target` | the `id` of the target element if it exists
|
||||||
|
Loading…
x
Reference in New Issue
Block a user