This library includes a few custom htmx
extensions that are not officially listed in htmx's extension page. The extensions are written in raw JavaScript to make usage and maintenance of them simple. Additionally, these files will just be hosted via GitHub and cached with their CDNs.
For extensions such as title-header
and icon-header
that introduce a new response header, these constants will be defined under /ext and can be imported as htmx_ext
.
All
src
attributes below point atlatest
and thus your site will always pull the latest version of the extension scripts. If you would like have more control about taking updates, it is recommended to replacelatest
in the path with a tagged release.
title-header
ExtensionThis extension adds client support for a new Hx-Title
response header that when present will update the browser tab's title element with the content provided. If the header is provided but with no content, the title will not be updated.
<script defer src="https://alehechka.github.io/htmx-go/ext/latest/title-header.js"></script>
<body hx-ext="title-header">
...
</body>
icon-header
ExtensionThis extension adds client support for a new Hx-Icon
response header that when present will update the browser tab's <link rel="icon" />
element's href
attribute. This allows dynamic browser icons on HTTP responses. If the header is provided but with no content, the href
will not be updated. If a <link rel="icon">
element does not exist in the DOM, one will be created with the provided href
from the response header.
<script defer src="https://alehechka.github.io/htmx-go/ext/latest/icon-header.js"></script>
<body hx-ext="icon-header">
...
</body>