</> htmx
🚧 htmx 4.0 is under construction. Read changes →

hx-preload

Note: This is an extension attribute. To use it, you must include the preload extension found at ext/hx-preload.js.

The hx-preload attribute allows you to preload content before the user actually triggers the request, improving perceived performance.

Installation

Load the extension in your htmx configuration:

htmx.config.extensions = 'preload';

Or load the extension file directly (if available as a separate extension).

Basic Usage

<a href="/details" hx-get="/details" hx-preload="mouseenter">
    View Details
</a>

Trigger Events

You can specify when to preload:

<button hx-get="/data" hx-preload="mouseenter">
    Load Data
</button>

Notes

See Also