Live data from Hacker News

Ask HN: What companies are embracing “HTML over the wire”?

news.ycombinator.com

81–90 of 192 posts

Re: Ask HN: What companies are embracing “HTML over the wire”?

#81

old man alert Back in my day, we wrote ASP.NET that was all server-side-rendered HTML. Once in a while we got REAL FANCY and used JQuery to make PARTIAL HTML requests and update only FRAGMENTS of the page. Hooboy I knew that fashion was cyclical but not tech!

Back in the days of MySpace, we were working for a client in UK Sports betting (Littlewoods Pools) - and we managed to persuade MySpace to let us have a script tag on the page, pointing to a JS file we controlled. The script injected jQuery, then we replaced the page with HTML fragments. We had an Adobe Air installer, a Flash game and even had an RSS feed. Funnily enough today we're mostly working towards using ESI -…

ESI is awesome and really connects "let's just cache it" with "but what if this tiny detail in the footer changes and we'll spent hours refreshing the cache". I would've loved to do more with it, but we added a lot more optimization that need to happen before the cache and require access to the whole page, so now I do a poor man's ESI transparently caching all kinds of widgets and shortcodes (Frankenstein's WP).

I guess one could potentially have tiered caches with an optimization layer in the middle and ESI on the backend-facing cache, but that feels extreme and more brittle.

Re: Ask HN: What companies are embracing “HTML over the wire”?

#82
post #45
post #8

Earlier quoted context omitted.

Partly, but it especially means things like Phoenix LiveView[0] or htmx [1]. With these you can create SPA like experiences by sending partial html updates from the server and applying them by some light JS to the UI (which you don't have to write yourself). [0] https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html [1] https://htmx.org/

The first time I saw the concept codified in a library was in a jquery function that allowed you to replace a part of the DOM. Either the method signature or the documentation pointed you to using it in pairing with AJAX requests. The first webapp framework I saw it in was Rails (turbolinks). I came to Rails late and didn't stay long so I was never clear how old or how broadly used that feature was. Mostly what I got…

i wouldn't call Element.replaceWith a codification of html-over-the-wire

Re: Ask HN: What companies are embracing “HTML over the wire”?

#84

old man alert Back in my day, we wrote ASP.NET that was all server-side-rendered HTML. Once in a while we got REAL FANCY and used JQuery to make PARTIAL HTML requests and update only FRAGMENTS of the page. Hooboy I knew that fashion was cyclical but not tech!

I wrote some jQuery-based code to enhance a page rendered by Rails this week, it felt pretty great as compared to waiting for Webpack to do its thing

Re: Ask HN: What companies are embracing “HTML over the wire”?

#85
post #44

Earlier quoted context omitted.

IF you want the page to be interactive without refreshes though, you gotta do something. Unless you are advocating a completely pre-ajax web. https://en.wikipedia.org/wiki/Ajax_(programming)

"HTML over the wire" generally refers to tech like [0] LiveView, [1] Hotwire, [2] LiveView, [3] Blazor, etc. They aren't about about ditching JS and more about not writing your HTML in JS (and yes, SSR). [0] https://github.com/phoenixframework/phoenix_live_view [1] https://hotwired.dev/ [2] https://laravel-livewire.com/ [3] https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blaz...

and https://htmx.org/ which is ... access to AJAX, among other things

Re: Ask HN: What companies are embracing “HTML over the wire”?

#86
post #71

Earlier quoted context omitted.

ColdFusion!!! Nice!!!

CF = Cloudflare. I would hope nobody is still writing things in ColdFusion these days :-)

Someone added a ColdFusion Markup Language generator to https://curlconverter.com/cfml/ last year and after a few months I decided to remove it since I've never heard of it so nobody could possibly be using it, and the next day the guy who added support for it and 3 other people complained about it, so it seems like they're out there.

https://github.com/curlconverter/curlconverter.github.io/pul...

Re: Ask HN: What companies are embracing “HTML over the wire”?

#87
post #61
post #51

Earlier quoted context omitted.

isnt ajax fancy sending html over the wire? or is it just the non fancy way?

AJAX stands for Asynchronous JavaScript And XML--it was originally designed for asynchronously manipulating XML data using JavaScript because at the time, the future was XML. The act of using JavaScript to send requests is still sometimes referred to as AJAX, despite usually not dealing with XML in any way. The most common use for sending asynchronous requests is making API calls, which today generally return JSON, b…

the person I replied to said "we dont need any of this fancy hotloading" and then gave examples of fancy hotloading, hence me asking, and pointing out the contradiction.

Like you said, AJAX isnt limited to XML, and is really just referring to any use of XMLHttpRequest to hotload data whether its XML, JSON etc.

I wasnt asking what ajax was. I was asking if it falls into the definition of "fancy."

I think my parent proved the opposite point they meant to. old reddit and hn and wp ARE the fancy html over wire sites, and airbnb and reddit are NOT the fancy over wire sites.

Re: Ask HN: What companies are embracing “HTML over the wire”?

#88
Where I work we're currently developing an administration / employee-only pages using server-side Blazor.

I don't know if this counts as "HTML over the wire" because server-side Blazor contains some magic to make the page kinda-sorta act like AJAX. It's a little laggy, but for our purposes, it's "good enough."

(The customer-facing pages are going to be SPAs, for very good reasons.)

https://optirtc.com/company/careers/

Re: Ask HN: What companies are embracing “HTML over the wire”?

#89
post #73

Earlier quoted context omitted.

Why are refreshes assumed to be bad?

Refreshes can be very fast, and often essentially invisible in modern browsers, when you don't bloat the page unnecessarily, but I think AJAX still has a use for things like the voting button on HN or "add to cart" buttons in a web shop. It would be annoying to lose the scroll position (and perhaps other state) for each item you want to add/upvote. (Although modern sites that try to sweep latency under the rug by imm…

Also browser refreshes should definitely not lose scroll position, though I can understand how with full ones the former position might not be the "correct" one any more with dynamic content like HN... or substack comments (and how did those manage to be so slow and buggy displaying what is almost exclusively text ?!)

Re: Ask HN: What companies are embracing “HTML over the wire”?

#90
post #50

We are using Django+HTMX for internal applications. Some random tips: - Write a "Django context processor" to inspect requests for "Hx-Request" header, and set a "base_template" variable accordingly. This means that any template that {% extends base_template %} will react to being a full page or just a fragment and you don't even have to think about that in your view logic. Great for progressive enhancement. - You ca…

do you have any code examples you'd be able to share that uses the base_template thing?

Sure, Django docs say this about custom context processors: https://docs.djangoproject.com/en/4.1/ref/templates/api/#wri...

So in my context_processors.py file, I write something like:

    def base_template(request):
        template = "templates/base.html"  # full page

        if "HX-Request" in request.headers:
            template = "templates/base_ajax.html"  # minimal template

        return {"base_template": template}
And then my template just needs to start with `{% extends base_template %}`. Nothing needs to be done in the view (although you could technically override "base_template" there, if you need to).
Post reply on HN