I remember once learning that php has a `header` function and have been using 'location:...' since ever (pre-2000) as php was almost always supported by hosters like dreamhost, hostgator, and nearly every Linux install came pre-installed with Apache and the php mod. The meta htttp-equiv was a last resort (like gh-pages). Never really used the JS option unless it was part of the application.
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.
Ha remember that too! It’s basically just keeping the socket open and continuously streaming a response. As if it’s just a slow download. It’d also send heartbeat null values to keep the connection open. Of course in the CGI days that really didn’t scale well as it required a whole process to run for each user.
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.
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.
I got PTSD... then again, a lot of things were wrong about that system. GET requests casually loading up whole database in memory while calling stored procedures that inexplicably modify like half of persisted version of it. and that's just to render some stupid list o_0
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.
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 <img>.
Combining it with the referrer tag and you can make some pretty interesting graphs. With frames you can even do Floyd's algorithm.
I made a demo of this about 20 years ago but I think it just confused people. One of my early flops that I thought was cool. It was all in perl and I think there was some JS in there as well but I don't remember anymore. No idea where it is now.
Rewrite it and make a hyped up pitch page. People will call you a genius and I'll pretend not to care
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.
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.
Most people learned about this stuff by searching the web back in the day, instead of "reading proper books and RFCs." The reason this knowledge is lost is entirely due to modern web dev taking place within frameworks that abstract all that lower-level knowledge away.
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 <branch_name>.
Maybe because we collectively pretty badly handled knowledge transmission between generations.
For the pioneers the most difficult part of learning CS was to get hardware needed. This mostly determined the technological stack they would then learn.
Nowadays hardware is commodity and the main problem is to determine what the hell you should start learning first because you can't learn everything it has now became humanely impossible.
I was born somewhen in the middle. Because of my first field I wish I could have mastered python. But at that time the python2/3 war was at the highest and you couldn't find reliable documentation. Hell even python3 tutorial kept on blabbering about how python2 concept translated. What was i supposed to do? learn both?
That is why I focused on SQL because at least documentation was quite stable (special thanks to PostgreSQL documentation teams).
I can only imaging the nightmare that must endure rookies frontend dev nowadays.
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.
Therefore the method called "progressive enhancement" might be an option to start with an HTML-only variant and load JS only if available and required for the current page.
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 won't know, on the first page hit, if the client has scripting enabled. At this point in time only the client knows if scripting is available. Also browser capability sniffing based on headers sent from the client in the first request is not reliable.
> 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 <meta> element or the <noscript> element. Just redirect with HTTP. If you try to use HTML for this, you’ll be serving up 200 OK responses and things that understand HTTP but not HTML won’t understand there’s a redirect.
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 enabled but these are not always reliable. Only the browser knows authoritatively if scripting is available and hence you should use the noscript element to respond to clients that disabled scripting.
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.
<noscript> 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 <noscript> 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.
I've recently deployed this trick on my company's confluence instance (with an HTML macro) to create a "poor man's" link shortener that allows me to change the link target after the fact.
Also recently deployed it as a very simple server side denounce: when the client first accesses page X a long running operation is dispatched. Subsequent requests for the same resource before it's done processing return a plain HTML response that says "Still thinking about it" and meta refresh after 1 second.
Hehe, the good old html meta redirect. As a kid in the early days of the web I loved to post redirects to porn websites in guestbooks to check if the website was sanitizing the user content properly. Worked way to often :D
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 language on top of the previous version, HTML 4.01, as well as improving or removing some existing functionality. However, as a Living Standard HTML now has no version.
Even though it may cover a lot of basic and familiar topics, I think the following is the best (re)introduction to HTML:
Web development has trained me to Google (now often ChatGPT) everything even if I already know how to do it because it changes so much haha
It makes me look stupid in code interviews because I commit very little to memory but professionally it's helped me catch a lot of syntactical upgrades.
Putting 0 value used to be a bad idea, as it was a signal to the browser and various ad blockers and anti viruses that it was a rogue redirect. Wonder if it’s different these days?