Sure. There's that. But it doesn't progressively enhance. It doesn't even fail gracefully. It's just... nothing without JS. That's bad accessibility. For for-profit and institutional use cases that's fine. But if you're a human person and want to make a website that all human persons around the world can read, it's a bad fit.
Thanks for pointing out a mitigation. I'm confused though. How does "htmx sends a request header HX-Request: true with every request." happen without javascript? And does this imply you need a backend server that understands whatever this header is for the graceful fallback? Ie, it wouldn't work with just nginx...
> How does "htmx sends a request header HX-Request: true with every request." happen without javascript?
It doesn't. If JavaScript is disabled, this header is not sent.
> you need a backend server that understands whatever this header is for the graceful fallback
Yes, as I mentioned in my blog post linked earlier: 'the backend server can use a fairly simple heuristic to figure out that it should respond with a fragment:...The request has a header HX-Request...The request does not have a header HX-History-Restore-Request...If these two conditions are fulfilled, it can respond with a fragment. Otherwise, it can respond with a full page ie <!DOCTYPE html>... and so on.'
But...htmx is not really meant to work with just Nginx or other static web servers, it is meant to work with a BFF (backend-for-frontend) that specifically knows how to serve and handle the app in question.
From the criteria you have mentioned so far:
- Works without JavaScript
- Works with a static web server like Nginx
I can only conclude that you are talking about serving static sites with no dynamic interactivity. That's not really what htmx is about. Htmx is more like a simplified way to do SPA-like things.
> Htmx is more like a simplified way to do SPA-like things.
Okay. Then we agree. "Htmx is power tools for using Javascript to alter HTML".
With the implicit premise of starting from javascript you see that as "Power Tools for HTML". Without this premise I see it as "Power Tools for Javascript".
I think this distinction is not only important because I question the premise, but because many people who've talked to me about Htmx are confused about what Htmx is and believe that it works without javascript. This is not Htmx's fault, of course, but it could be made clearer by avoiding easily misinterpreted headlines like this.
>htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext
I hope you see how the full context can make it sound like it's HTML based and not javascript based, even if, yes, AJAX and WebSockets are JS things.