mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-03 07:45:21 +00:00
Support #anchor redirect refresh (#1172)
This commit is contained in:
parent
3845e0f92e
commit
7296c0d943
11
src/htmx.js
11
src/htmx.js
@ -3307,16 +3307,17 @@ return (function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var shouldRefresh = hasHeader(xhr, /HX-Refresh:/i) && "true" === xhr.getResponseHeader("HX-Refresh");
|
||||||
|
|
||||||
if (hasHeader(xhr, /HX-Redirect:/i)) {
|
if (hasHeader(xhr, /HX-Redirect:/i)) {
|
||||||
location.href = xhr.getResponseHeader("HX-Redirect");
|
location.href = xhr.getResponseHeader("HX-Redirect");
|
||||||
|
shouldRefresh && location.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasHeader(xhr,/HX-Refresh:/i)) {
|
if (shouldRefresh) {
|
||||||
if ("true" === xhr.getResponseHeader("HX-Refresh")) {
|
location.reload();
|
||||||
location.reload();
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasHeader(xhr,/HX-Retarget:/i)) {
|
if (hasHeader(xhr,/HX-Retarget:/i)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user