The htmx.config.extensions option restricts extension registration to listed names.

<meta name="htmx-config" content='extensions:"preload,hx-optimistic"'> <script src="/htmx.js"></script> <script src="/hx-preload.js"></script> <script src="/hx-optimistic.js"></script>

Both extension scripts still need to be loaded. The config only controls whether their calls to htmx.registerExtension() succeed.

Default

""

An empty string allows every loaded extension to register.

Extension Names

List names passed to htmx.registerExtension(), separated by commas:

htmx.registerExtension('preload', { /* ... */ }) htmx.registerExtension('hx-optimistic', { /* ... */ })

Configure Before Loading htmx

htmx reads the extension allowlist during initialization. Put the htmx-config meta element before the htmx script.

Changing htmx.config.extensions afterward does not change the active allowlist.

See Also