X-IC-Redirect implementation

This commit is contained in:
carson 2020-06-13 20:44:25 -07:00
parent 84200f4599
commit 17c3f74e0c

View File

@ -631,6 +631,25 @@ In hyperscript similar functionality is implemented like so:
</body>
```
##### `X-IC-Redirect`
Intercooler provided more response headers than htmx does: `X-IC-Refresh`, `X-IC-Redirect` etc. Htmx omits these
headers in favor of the general `HX-Trigger`, combined with some client side code.
Let's implement the `X-IC-Redirect` header using the `HX-Trigger` response header and some hyperscript.
First, let's trigger an event with a response header that looks like this:
`HX-Trigger:{"redirect":{"url":"https://htmx.org"}}`
Then we would write the following hyperscript:
```html
<body _="on redirect(url) put url into window.location">
...
</body>
```
##### `ic-switch-class`
Intercooler provided the [`ic-switch-class`](http://intercoolerjs.org/attributes/ic-switch-class.html) attribute, which