htmx/www/extensions/restored.md
makasaurus 8a7228c02a
adding support for hx-trigger="restore" (#668)
* adding support for hx-trigger="restore"

* switching over to an extension + docs + tests

Co-authored-by: 1cg <469183+1cg@users.noreply.github.com>
2022-02-04 11:09:18 -07:00

550 B

layout title
layout.njk </> htmx - high power tools for html

The restored Extension

This extension triggers an event restored whenever a back button even is detected while using hx-boost.

Usage

A page utilizing hx-boost that will reload the h1 each time the back button is pressed:

<body hx-boost="true">
    <h1 hx-ext="restored" hx-trigger="restored" hx-get="/header">Come back!</h1>
    <a href="/other_page">I'll be back</a>
</body>

Source

https://unpkg.com/htmx.org/dist/ext/restored.js