## Introduction

htmz is a remarkably minimalist JavaScript framework that brings partial page update capabilities to HTML using the humble target attribute. At just ~1KB, it proves that powerful hypermedia-driven applications don't require heavyweight libraries. The concept is elegant: use a hidden iframe to load HTML fragments and replace specific DOM elements with the loaded content. This approach leverages native browser mechanics rather than fighting against them.

Unlike traditional frameworks that require learning new syntax and conventions, htmz works with plain HTML. You simply set up your links with target attributes pointing to existing element IDs, and htmz handles the rest. The project has garnered over 2,000 stars, demonstrating that developers increasingly appreciate minimal, focused tools that do one thing exceptionally well.

## Core Highlights

  • Minimal Footprint: The entire framework is approximately 1KB, making it ideal for performance-conscious projects where every kilobyte matters
  • Native HTML Integration: Works with standard HTML attributes like target and name, requiring no custom syntax or configuration
  • Extension System: A growing collection of community-contributed extensions adds features like lazy loading, template swapping, and loading indicators

## English Community Discussions

Issue #2 - Using htmz without updating browser history (8 comments)

Developer lpil asked about controlling browser history behavior:

"Do you have a recommendation or an extension for not adding to the browser history when clicking on htmz links? I'd like my back button to (for example) go to what my user sees as the previous page rather than resetting a form to a previous state."

The maintainer Kalabasa addressed this by explaining htmz's iframe-based approach naturally doesn't pollute browser history, as the parent page URL remains unchanged during partial updates.

Issue #27 - Propagating redirects to the top window (6 comments)

Developer kiastorm raised an interesting use case:

"If there's an error, the server responds with the same form HTML fragment but with invalid inputs and error messages. If the request was successful, the server responds with a 302 and intends to redirect to a different page, full page reload. My problem is that in the case of a successful request, the page I intend to redirect to is rendered replacing the form. The redirect does not propagate to the top window."

This discussion explores how htmz handles server-side redirects and whether they should propagate to the top-level window for full-page navigation.

Issue #25 - Loader extension request state (18 comments)

Contributor Atmos4 proposed enhancements to the loading indicator:

"The loader extension is a bit too shallow: it will only show a loading spinner once the server has begun sending the first byte. This means it is not a true loading indicator (like htmx's hx-indicator), which is fine but quite limiting in terms of functionality, especially when trying to mitigate the 'laggy' feeling of hypermedia-driven applications."

This discussion led to proposals for improving the extension to better match htmx's loading indicator behavior.

## Summary

htmz represents a refreshing approach to web development—one that embraces browser capabilities rather than abstracting them away. Its ~1KB size makes it practically invisible in terms of bundle impact, while its iframe-based mechanism provides reliable partial page updates using nothing but HTML. The active community discussions show developers are finding creative ways to extend and adapt htmz for various use cases, from form handling to lazy loading. For projects seeking minimal dependencies without sacrificing interactivity, htmz offers a compelling alternative to heavier frameworks.

## Link

@Kalabasa / htmz