Live data from Hacker News

I just learned about HTML redirects (2020)

apitman.com

41–50 of 88 posts

Re: I just learned about HTML redirects (2020)

#41
post #36
post #30

Earlier quoted context omitted.

IIRC CGI:IRC had an even more clever version of this: still no JavaScript needed, but Also no refresh needed, as the chat frame response would simply be held open and stream new messages. I never dug too deep into it, but it seemed to work surprisingly well.

This is called Server Sent Events, SSE for short. https://developer.mozilla.org/en-US/docs/Web/API/Server-sent...

SSE came along much later. At the time it was common-ish to just slowly send HTML tags. I think at some point there was a gorgeous hack where they dynamically rendered and sent GIF frames with the messages of the chatroom.

Re: I just learned about HTML redirects (2020)

#42
post #26

Earlier quoted context omitted.

This is one of the oldest tricks in the book and was used heavily before WebSockets and similar became mainstream.

I fondly remember html-only iframe chats.

controversial opinion, frames were awesome...for some things

Re: I just learned about HTML redirects (2020)

#43
post #36
post #30

Earlier quoted context omitted.

IIRC CGI:IRC had an even more clever version of this: still no JavaScript needed, but Also no refresh needed, as the chat frame response would simply be held open and stream new messages. I never dug too deep into it, but it seemed to work surprisingly well.

This is called Server Sent Events, SSE for short. https://developer.mozilla.org/en-US/docs/Web/API/Server-sent...

The broader technique became known as Comet: https://en.wikipedia.org/wiki/Comet_(programming)

CGI:IRC used an early frame approach, no JS required.

At some point JSONP became popular, even for 3rd party APIs.

  
Server writes:

  lol({ ... })

  lol({ ... })

Re: I just learned about HTML redirects (2020)

#44
post #13

Ok, I'll bite - how else do people do this? (Speaking as someone who has ONLY ever done it this way.)

The noscript tag is the correct way to do this. Server side, when you first generate page content you have no idea if the client has scripting enabled, which is why you include a noscript element to advise the user what to do, or redirect them using a meta tag inside the noscript element. So all these suggestions below to use server side generated HTTP headers and 302 (or 301) redirects are incorrect...because you wo…

[deleted]

Re: I just learned about HTML redirects (2020)

#45

Ahh. This brings back memories. I used to do this when I was using Adobe (Macromedia originally) FLASH back in the day. If no FLASH, show them the shitty version. HAHA. Good times.

You'd be surprised how often Flash was "the shitty version" as it was almost always bloated with long load times, inaccessible content and a lot of pointless stuff that was clearly to impress the client who comissioned it , not the poor user who wanted to find something out.

O no doubt.

Re: I just learned about HTML redirects (2020)

#46
post #36
post #30

Earlier quoted context omitted.

IIRC CGI:IRC had an even more clever version of this: still no JavaScript needed, but Also no refresh needed, as the chat frame response would simply be held open and stream new messages. I never dug too deep into it, but it seemed to work surprisingly well.

This is called Server Sent Events, SSE for short. https://developer.mozilla.org/en-US/docs/Web/API/Server-sent...

SSE is cool, but as others have pointed out, this isn't that. I also wouldn't call this Comet: almost unilaterally, Comet referred to using it in concert with JS/Ajax and usually was just a fancy way of saying long-polling (though I admit it's a bit broader than that in truth). What CGI:IRC did was different: it streamed HTML directly. More to the point, it didn't use chunked encoding or any kind of framing in the body. It just kept the connection open and kept sending HTML in realtime. I don't think this ever had a term associated with it, or at least I was never aware of one.

Re: I just learned about HTML redirects (2020)

#47
post #46
post #36

Earlier quoted context omitted.

This is called Server Sent Events, SSE for short. https://developer.mozilla.org/en-US/docs/Web/API/Server-sent...

SSE is cool, but as others have pointed out, this isn't that. I also wouldn't call this Comet: almost unilaterally, Comet referred to using it in concert with JS/Ajax and usually was just a fancy way of saying long-polling (though I admit it's a bit broader than that in truth). What CGI:IRC did was different: it streamed HTML directly. More to the point, it didn't use chunked encoding or any kind of framing in the bo…

Looks like 'Comet' got coined in 2006. The CGI:IRC approach.. I had a smile and an "aha" on seeing the term "forever frames" :-)

I think the wiki page is wrong that it involved chunked encoding

Re: I just learned about HTML redirects (2020)

#48
post #24
post #13

Ok, I'll bite - how else do people do this? (Speaking as someone who has ONLY ever done it this way.)

one way it's not done is with DNS

Well...

Serve a "shitty" page by default, redirect with JS to "enriched" page. Or tinker with server configuration to depend on 'Host: nojs.plz.fqdn'.

Re: I just learned about HTML redirects (2020)

#49
post #47
post #46

Earlier quoted context omitted.

SSE is cool, but as others have pointed out, this isn't that. I also wouldn't call this Comet: almost unilaterally, Comet referred to using it in concert with JS/Ajax and usually was just a fancy way of saying long-polling (though I admit it's a bit broader than that in truth). What CGI:IRC did was different: it streamed HTML directly. More to the point, it didn't use chunked encoding or any kind of framing in the bo…

Looks like 'Comet' got coined in 2006. The CGI:IRC approach.. I had a smile and an "aha" on seeing the term "forever frames" :-) I think the wiki page is wrong that it involved chunked encoding

Woah! I completely and entirely forgot the term "forever frame" existed.

Another term you don't see too often these days is the "holy grail" layout. I definitely remember the days of messing with negative margins and clearfix to get my page layouts to look nice while still working in IE 6 :)

Re: I just learned about HTML redirects (2020)

#50

Earlier quoted context omitted.

That wouldn't work in a noscript

Not sure why you're being downvoted. Many of the sibling comments are referring to server side generated HTTP 302 headers, and server side (without lots of fancy shenanigans) you won't know (server side) if the client has disabled scripting on the first page hit. And document.location is pointless if the client has turned off scripting.

Different readings of the initial question:

A) “how do people redirect”, to which the point about noscript sounds like irrelevant whining

B) “how do people redirect only visitors who don’t have scripting” to which most of the answers are trivially wrong

Post reply on HN