diff --git a/www/content/extensions/preload.md b/www/content/extensions/preload.md index ed26f726c..eea05fb53 100644 --- a/www/content/extensions/preload.md +++ b/www/content/extensions/preload.md @@ -13,7 +13,7 @@ unused requests. Use this extension carefully! ## Install ```html - + ``` ## Usage @@ -35,6 +35,8 @@ giving your application a roughly 100-200ms head start on serving responses. See ``` +All preload requests include an additional `"HX-Preloaded": "true"` header. + ### Inheriting Preload Settings You can add the `preload` attribute to the top-level element that contains several `` or `hx-get=""` @@ -52,6 +54,15 @@ you preload many more resources than you need. ``` +### Preloading Forms + +The extension can preload some form elements if the form includes `hx-get` attribute or uses `method="get"`. The `preload` attribute can be added to the form or to some of its selected elements. Currently these form elements can be preloaded: +- `` will be preloaded as if the radio button was clicked and form submitted +- `` will be preloaded as if the checkbox was checked and form submitted +- `` will be preloaded as if the checkbox was unchecked and form submitted +- `` will be preloaded as if form was submitted + ### Preloading of Linked Images After an HTML page (or page fragment) is preloaded, this extension can also preload linked image resources. It will not @@ -115,6 +126,13 @@ trigger preloads as soon as an object has been processed by htmx. ``` +#### preload="always" + +By default, the extension will preload each element once. +If you would like to keep always preloading the element, you can add `preload="always"` attribute. +This can be useful if `hx-target` is not the element itself. +This attribute can be conbined with other configuration attributes e.g. `preload="always mouseover"`. + ### About Touch Events To accommodate touchscreen devices, an additional `ontouchstart` event handler is added whenever you specify