Readit News logoReadit News
amaury_bouchard commented on Show HN: µJS, a 5KB alternative to Htmx and Turbo with zero dependencies   mujs.org... · Posted by u/amaury_bouchard
panny · 3 days ago
I tried this out today and it doesn't seem to work for me, because it only considers relative urls to be "internal." If the urls are full urls (https://domain:port/...) then it won't work. It seems like it should be able to use window.location to work out that these full urls are also "internal" as well.
amaury_bouchard · a day ago
Thanks for the report! This is now fixed in v1.4.4.

µJS now resolves URLs using the native URL constructor and compares origin against window.location.origin. This means all same-origin URLs are correctly recognized as internal: - Absolute URLs: https://domain:port/page - Relative URLs: ../page.html, page.html - Local paths: /page (already worked)

Hash-only links (#section) are intentionally left to the browser for native anchor scrolling.

amaury_bouchard commented on Show HN: µJS, a 5KB alternative to Htmx and Turbo with zero dependencies   mujs.org... · Posted by u/amaury_bouchard
h4ch1 · 5 days ago
Hey, cool library had just a small nitpick/request wrt https://mujs.org/playground

Could you please add all sources as tabs? For example in Form (GET) I would really like to see /demos/search-results.html and the same goes for other examples.

Thanks!

amaury_bouchard · 3 days ago
Good news, I've just added the server-side source as a tab in the Playground. Thanks again for the suggestion!
amaury_bouchard commented on Show HN: µJS, a 5KB alternative to Htmx and Turbo with zero dependencies   mujs.org... · Posted by u/amaury_bouchard
panny · 3 days ago
I tried this out today and it doesn't seem to work for me, because it only considers relative urls to be "internal." If the urls are full urls (https://domain:port/...) then it won't work. It seems like it should be able to use window.location to work out that these full urls are also "internal" as well.
amaury_bouchard · 3 days ago
Thanks for the report! Using fully absolute URLs for internal links is not a very common pattern, and this hadn't been raised before. That said, it's a valid and interesting use case, I'll add it to the roadmap. In the meantime, using root-relative URLs (starting with /) is the recommended approach.
amaury_bouchard commented on Show HN: µJS, a 5KB alternative to Htmx and Turbo with zero dependencies   mujs.org... · Posted by u/amaury_bouchard
lastdong · 5 days ago
You should be able to push to history using history.pushState(…) after loading a new page. There are probably more details needed around popState to handle back and forward navigation. I’m sure Claude will be able to assist here, but maybe too much complexity when other similar libraries may also manage history state.
amaury_bouchard · 3 days ago
Yes, µJS manages browser history out of the box.
amaury_bouchard commented on Show HN: µJS, a 5KB alternative to Htmx and Turbo with zero dependencies   mujs.org... · Posted by u/amaury_bouchard
zoezoezoezoe · 3 days ago
"feel like a single-page app" except that its not and it will never be. I hate HTML-over-the-wire solutions to any problem. There is not a worse solution that has been more normalized than html-over-the-wire.
amaury_bouchard · 3 days ago
Fair enough, it's clearly not the right tool for everyone. HTML-over-the-wire works well for server-rendered apps where the primary interaction is fetching and displaying content. For highly interactive UIs with complex client-side state, a proper SPA framework is the better choice. Different problems, different tools.

That said, the vast majority of websites are purely transactional: click a link, load a page; submit a form, load a page. For those, there's little reason to add a full frontend framework. HTML-over-the-wire can improve responsiveness without adding complexity.

amaury_bouchard commented on Show HN: µCSS, a CSS framework with 17 components, 20 themes, no build required   mucss.org... · Posted by u/amaury_bouchard
AlbertoGP · 4 days ago
I will try this out later, but for now the address https://mucss.org/ does not work for me. The Github link does.
amaury_bouchard · 3 days ago
Thank you for the information. There was a DNS misconfiguration, but it should be fixed now (allow some time for DNS propagation).
amaury_bouchard commented on Show HN: µJS, a 5KB alternative to Htmx and Turbo with zero dependencies   mujs.org... · Posted by u/amaury_bouchard
amluto · 4 days ago
I have a project that has ordinary internal links, but they’re all relative because the entire project can be based at a variable path.

If I were to adopt µJS, though, I would probably want to opt in on a per-link basis.

amaury_bouchard · 4 days ago
That's a valid use case. For opt-in per link, you can disable global link interception with `mu.init({ processLinks: false })` and then add `mu-url` explicitly to the links you want µJS to handle. For the variable base path scenario, the `urlPrefix` option in `mu.init()` might also help. It prepends a prefix to all fetched URLs.

That said, proper support for relative paths is on the roadmap.

amaury_bouchard commented on Show HN: µJS, a 5KB alternative to Htmx and Turbo with zero dependencies   mujs.org... · Posted by u/amaury_bouchard
jadbox · 4 days ago
I love this- I'll give it a spin. I'd really want web developers to start making websites again that can run without javascript, but it can feel like a SPA if JS is available. This has always been 'possible' but, in practice, it's a massive pain. uJS and HtmX could help to be the polyfill solution to make this possible.

That said, I worry about Form elements being controlled by uJS to use a different REST method (like DELETE), and this would cause JS-free browsers to break.

amaury_bouchard · 4 days ago
Glad it clicks! On the progressive enhancement point, µJS is designed exactly with that philosophy in mind: standard links and forms work without JS, µJS just enhances them.

Your concern about `mu-method="delete"` is valid. Without JS, the browser will fall back to the form's native method (usually GET or POST). The classic solution is the `_method` hidden field pattern: the form submits POST with a `_method=DELETE` field, and the server reads that field to route the request correctly. µJS doesn't need to implement anything special for this, it's a server-side convention

amaury_bouchard commented on Show HN: µJS, a 5KB alternative to Htmx and Turbo with zero dependencies   mujs.org... · Posted by u/amaury_bouchard
amluto · 4 days ago
I’m curious: why does the default behavior do the magic replacement for absolute paths links but not for relative paths?

Also, perhaps the CDN script snippets in the getting started page should include the integrity attribute.

amaury_bouchard · 4 days ago
Good points, thanks!

On relative paths: the current behavior is intentional for simplicity. µJS checks whether the URL starts with a slash (but not a double slash) to identify internal links. No one has reported this as an issue so far, but it's a valid feature request and I'll keep it in mind for a future version.

On the integrity attribute: the reason it was missing is that the library was evolving quickly and the hash would have changed with every release. Now that it's stable, I'll add it.

u/amaury_bouchard

KarmaCake day69March 6, 2026
About
Born in Montreal and living in Paris, I’m both French and Canadian. I have an M.S. in System & Network from Epita (one of the best French schools in computer science) and +20 years of experience mostly in back-end web development and management. I also did an Executive MBA in Management & Entrepreneurship from Epitech and a certification in Software Product Management from the University of Alberta.

My personal work spans software, games, and tools (all published under open source licenses): - Temma (https://www.temma.net): PHP MVC framework, easier than the big frameworks, more useful than the micro-frameworks - µJS (https://mujs.org): Lightweight AJAX navigation library, 5KB alternative to Turbo and htmx - µCSS (https://mucus.org): Full-featured CSS framework, based on PicoCSS - Arkiv (https://github.com/Digicreon/Arkiv): Easy-to-use backup and archive tool - Dispak (https://github.com/Digicreon/Dispak): Extensible tool for managing Git repositories and project deployment - Rolis (https://www.rolis.net): A list of open-sourced tabletop role playing games, and multi-engine open-source scenarios - Pandocreon Menhir (http://www.pandocreon.com/jeux/menhir/): Award-winning boardgame

View Original