Live data from Hacker News

I just learned about HTML redirects (2020)

apitman.com

81–88 of 88 posts

Re: I just learned about HTML redirects (2020)

#81

Earlier quoted context omitted.

Most of the time it’s via a server redirect or a rule on the load balancer.

Ok, how does the server or the load balancer know if scripting is enabled on the first request?

The 30x redirect status codes are handle by the browser whether or not scripting is enabled. It is part of the http standard.

https://www.rfc-editor.org/rfc/rfc9110#status.301

Re: I just learned about HTML redirects (2020)

#82

This is also used as a poor man’s live feed: just use this element to reload the page or frame on a set interval.

Also not widely known: the multipart/x-mixed-replace media type, allowing you to send multiple files and have them replace each other. A simple streaming solution without video, WebSocket, or JavaScript, just an .

Re: I just learned about HTML redirects (2020)

#83

This is also used as a poor man’s live feed: just use this element to reload the page or frame on a set interval.

Long polling HTML was popular for a while in the early aughts. Just never close the HTTP connection and stream new HTML elements onto the page. I don’t think that would get along with modern tooling.

Re: I just learned about HTML redirects (2020)

#84
post #72

This reminds me that while I’ve been programming for a paycheck since 1998 my knowledge growth in html stopped at about 2001. Are there any good courses or recommendations for seasoned pros who never stopped to learn HTML5?

> The term HTML5 is essentially a buzzword that refers to a set of modern web technologies. This includes the HTML Living Standard, along with JavaScript APIs to enhance storage, multimedia, and hardware access. > You may sometimes hear about "new HTML5 elements", or find HTML5 described as a new version of HTML. HTML5 was the successor to previous HTML versions and introduced new elements and capabilities to the lan…

> The term HTML5 is essentially a buzzword

HTML5 is just the common name of the living standard. It's clear, unambiguous, and what everybody uses. It is not a "buzzword".

Re: I just learned about HTML redirects (2020)

#85
post #64
post #63

Earlier quoted context omitted.

This is what you get if you learn everything by just googling exactly what you need for the moment. Reading proper books and RFCs are underrated these days.

I regularly ask people: have you read the man page? Seems a minimum effort one can do.

The man page for git has 1085 lines on my system. That's just too long with too much irrelevant information to be reasonable to expect someone to read when they just want one thing. I've never used them in all my time in the industry.

ChatGPT is a life saver for me though. I looked all over to try to find how to just see the history of a branch and got a million wrong results, but ChatGPT on GPT4 told me right away it was git log --first-parent .

Re: I just learned about HTML redirects (2020)

#86

Earlier quoted context omitted.

> The term HTML5 is essentially a buzzword that refers to a set of modern web technologies. This includes the HTML Living Standard, along with JavaScript APIs to enhance storage, multimedia, and hardware access. > You may sometimes hear about "new HTML5 elements", or find HTML5 described as a new version of HTML. HTML5 was the successor to previous HTML versions and introduced new elements and capabilities to the lan…

> The term HTML5 is essentially a buzzword HTML5 is just the common name of the living standard. It's clear, unambiguous, and what everybody uses. It is not a "buzzword".

I tracked down the Git history where the phrase "essentially a buzzword" was introduced in this pull request:

https://github.com/mdn/content/pull/5116/files#diff-7cfca62e...

I agree that it's unnecessarily dismissive.

Re: I just learned about HTML redirects (2020)

#87

Earlier quoted context omitted.

Ok, how does the server or the load balancer know if scripting is enabled on the first request?

The 30x redirect status codes are handle by the browser whether or not scripting is enabled. It is part of the http standard. https://www.rfc-editor.org/rfc/rfc9110#status.301

I know this, please read my comment here:

https://news.ycombinator.com/item?id=35675861

Re: I just learned about HTML redirects (2020)

#88

Earlier quoted context omitted.

> So all these suggestions below to use server side generated HTTP headers and 302 (or 301) redirects are incorrect...because you won't know, on the first page hit, if the client has scripting enabled. Perhaps I’m misunderstanding you, but do you think that the HTTP approach only works when JavaScript is enabled? That isn’t the case. Go ahead and use HTTP 3xx responses; they work in all cases. Don’t use the element o…

Ok, in the context of the article, what I'm saying is when a browser requests a page for the very first time, the server will have no idea if scripting is enabled and so your server side code will have no idea whether to send a 302 redirect to your no-script content . This is why the noscript tag exists and should be used. Yes I'm aware there are various sniffing techniques you could use to work out if scripting is e…

Oh I see what you mean now. You don’t think that determining scripting capability is necessary for the redirect, you only care about it because it’s the purpose for the redirect in this case.

In that case I would completely reposition the argument: you shouldn’t do this at all, so it doesn’t matter how you redirect. It’s basically never the right move to try to sort your users into JavaScript and non-JavaScript and have two different pages for each.

is an ancient design assuming that JavaScript is a binary enabled/disabled state, however this simply is not reflective of the real world. The vast majority of cases in which JavaScript does not execute will happen in the context of somebody using a browser with JavaScript enabled, so can’t help you. You can use the latest version of the most popular browser, with all the settings enabled, no firewall or filtering, using a perfect Internet connect, no extensions getting in the way, with bug-free JavaScript delivered flawlessly, and still not have the JavaScript execute. And of course, if any of those factors vary, that can also lead to the JavaScript not executing.

If you want to handle this situation reliably, you need to build the page so that it works without JavaScript and then have the JavaScript that ends up executing progressively enhance the page.

Post reply on HN