You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* htmx 2.0 offers [automatic head merging](#head-support) with boosted links. If you do not want this behavior, set you can set `htmx.config.head.boosted` to `"none"`
205
205
206
206
IE is no longer supported in htmx 2.0, but htmx 1.x continues to support IE and will be supported for the foreseeable
207
207
future.
@@ -779,6 +779,46 @@ Here is an example:
779
779
780
780
The anchor tag in this div will issue an AJAX `GET` request to `/blog` and swap the response into the `body` tag.
781
781
782
+
### `head` tag support
783
+
784
+
In boosted requests, if a head tag is detected in the response, htmx will automatically synchronize the content of
785
+
the current head tag with the new content. This means that elements that are already found in the current head will
786
+
be left alone (and, therefore, not trigger another request), but new elements found in the new header will be added
787
+
to the existing header tag. Elements that are not found in the new head will be removed from the existing head tag.
788
+
789
+
This allows you to include page-specific header related elements and have them added or removed via boosted requests.
790
+
791
+
htmx also supports an "append" mode, that will simply append the content of the new head tag to the current head, if
792
+
the new content is not already in it. You can control the mode that htmx will use with the `hx-head` attribute on
793
+
the head tag in the *new* content:
794
+
795
+
*`merge` - follow the merging algorithm outlined above
796
+
*`append` - append elements that do not exist in it to the existing head, but don't remove any elements
797
+
798
+
#### Controlling Merge Behavior Per Element
799
+
800
+
You may also control merging behavior of individual elements with the following attributes:
801
+
802
+
* If you place `hx-head="re-eval"` on a head element, it will be re-added (removed and appended) to the head tag on every
803
+
request, even if it already exists. This can be useful to execute a script on every htmx request, for example.
804
+
* If you place `hx-preserve="true"` on an element, it will never be removed from the head, regardless
0 commit comments