Hacker News new | ask | show | jobs
by NelsonMinar 747 days ago
Sometime in the early 2000s, before AJAX was a thing, Adam Rifkin showed me a demo from his startup KnowNow that was achieving the then-mind-blowing thing of a web page updating itself without refreshing. Their trick was to keep the HTTP request open and the server to send occasional updates. More HTML. I don't think they could even manipulate the DOM back then, it may literally have been a page that just never closed the <html> tag.
5 comments

This is how AJAX in Java Server Faces used to work nearly 2 decades ago. There were even more fancy technologies like https://www.icesoft.org/wiki/display/ICE/Direct-to-DOM+Rende...

I bet ASP had something similar too around the same time

I meant to reply to GP about partial updates rather than parent post about keeping connection open.
I did something similar (same time frame) that definitely manipulated the DOM, but I didn’t keep the HTTP connection open, I used hidden Iframes. Clicks got redirected to the iframe, which returned <script> elements that would replace DOM elements (in the parent frame) using their .innerHTML.

AJAX streamlined the process, but there were a lot of hacky ways to get similar dynamic HTML effects. I like the idea of keeping the HTTP connection open, but that seems quite resource intensive… particularly for the early 2000s.

This technique is called COMET. The very first web chat that I used way back in 1996 was COMET based, tho the term hadn’t been coined yet. It was the chat room on Sierra Online’s website. The app had two frames, one for the input field and another for the room feed, which was a long running connection. No JavaScript, just a never ending HTML page. I suspect the backend was written in Perl, as it was a cgi script.

Basically the server sends a multipart content type header, never sends a content size, and simply doesn’t terminate the connection, so the browser just waits patiently for more parts and renders them as they come. My team experimented with it a bit back in 2000 for doing what would eventually be termed JSONP Streaming. It was really cool tech, but we didn’t have a practical application for it.

Thank you, I'd forgotten that name Comet. Wikipedia has some more info: https://en.wikipedia.org/wiki/Comet_(programming)
Well, you could manipulate the DOM with that technique by sending <script> tags to do so.
Internet Explorer 5 introduced XMLHttpRequest (ActiveXObject) in 2001.
It was fairly easy to communicate between frames with JavaScript, so before this was widely adopted, I remember the way we used to “fetch” new data was with an iframe that always had a meta refresh tag in it, and the server response would include JavaScript that would call into functions from the main window passing along any data that was needed.

I might be wrong, but I think even early versions of Gmail did something similar.

Below is an interesting read about the history and evolution of XMLHttpRequest.

Started in 2000 in Exchange/Outlook web and took a year or two to become prevalent in the browsers and other places.

https://medium.com/@mohamedtayee3/make-an-http-request-in-ja...

Yes, but developers weren't widely aware of its power until the launch of Gmail in 2004, and the term "AJAX" wasn't used until 2005.
People were definitely experimenting with it before that. Developers were mostly using it to load direct server-side snippets of HTML, dynamically. It took the evolution of SOAP and (especially) JSON/RESTful APIs for it to start seeing mass adoption as the combined technology of "AJAX".

Prototype.js and jQuery had a big hand in the latter.

what made Gmail memorable was cross browser ajax. Prior to, you had things like OWA but it only worked right in IE.

The big inbetween OWA and Gmail, was Oddpost, which was also IE only, and was purchased by Yahoo three months after gmails April Fool announcement, to become Yahoo Mail. In a roundabout way, you can argue gmail was a copy of what was eventually Yahoo Mail.