Hacker News new | ask | show | jobs
by fexelein 1346 days ago
As recent as 2016 I was building some sites without any JavaScript. These weren’t small sites either. You can achieve a lot using some basic forms. It was quite fun
3 comments

95% of the functionality web apps I've been put in charge of building works without JavaScript. You do lose things like form validation, and some of the links to things like detail forms opens in the same window instead. Or, say, a master/detail selection having a full list of hundreds of items instead of 90% of them hidden based on <optgroup>

It's useful for most of the reasons listed in the parent article.

You can also do quite a lot in CSS these days for interactivity - and with better performance than JS. Expand/collapse sections (with animation), menus including transition delay for more mouse forgiveness, slide out panels.. Also pretty easy to then tweak it for alternate mobile layout.

HTML and CSS have form validation too. You can do something like :has(:valid) when you add in your validation schema in the HTML.
Yep! Regrettably the issue I had was getting JS and HTML5 form validation to work nicely together. The issue was that the HTML5 validation was triggering before the onsubmit which was when we were reviewing the entire form for consistency. So even though we played around with it, and in some places used it for "required" it just didn't work out too well with a lot of the ways we were validating forms. I'm sure we could have made it work - turning on and off the HTML5 validation as needed, using an onclick or some other event instead, but it was easier to just let the non-JS version be validated server-side (which we obviously do as well, as any sane dev would).

I am a fan of the HTML5 validation though - offered feedback when they were working on it that I think made it into the spec like interaction of required and hidden elements...

And, I suspect for most of our forms the simple patterns of HTML5 validation would be fine, it's just that sometimes it wasn't, and it was easier to be consistent in how validation worked and looked... So. Chalk it up to laziness. So long as the forms still worked we decided to let it be.

"I Turned Off JavaScript for a Whole Week and It Was Glorious - Wired 2015"

It's not 2015 or 2016 anymore, not even close. We're the better part of a decade moved on. This is not a valid argument any longer. JavaScript is a critical part of the modern web experience. You may not like it, but that doesn't change the fact.

I just read through that article. Of the specific things it mentions, I think Twitter might no longer work without JavaScript, but everything else is true now just as it was then.

Nothing has changed.

Source: personal experience, as one who blocks JavaScript by default because it makes the web better more than it breaks things. Also very occasional observation of people browsing the web with very similarly-configured browsers apart from the disabling of JavaScript, and of people browsing the web without even uBlock Origin or similar (and that’s really painful to watch).

I block 3rd-party JS by default. (I'm not sure who the second party is supposed to be, I guess that's me). I'll take JS that you serve me yourself.

Basically, I'm willing to trust a site that I've deliberately visited; but if they want to load a score of scripts from sites I haven't deliberately visited, and I can't see content without them, I'm outa there. Often these are big scripts; and the site-owner can't possibly be vouching for them, if he's not even serving them himself.

I think linking out to 3rd-party Javascript is lazy and irresponsible. Any testing you've done on it could become obsolete at any time, without notice. It's done to avoid having to keep up with patches; "No, I don't know what version of JQuery you got served; you were supposed to get served the latest".

Twitter removed their non-JS interface but Nitter still supports it just fine.
The problem is that JavaScript is used for tons of garbage purposes too. I wish for more control in my browser over what is running
Faulting a technology for its malicious uses is a common fallacy, but a fallacy nonetheless. Not saying you're wrong (you're not), but it's not a valid argument against JavaScript.
If something is ubiquitous it will be used in its most extreme negative form.

This is why things being generally available that have the potential to be harmful causes such a debate, because on the one hand it’s useful, on the other it’s harmful.

The reason people blame the tool is because the tool enabled people to be able to maximise their harm, and people will maximise harm when given the opportunity.

In this case: JavaScript enables people to externalise their processing cost into people’s own computers, which is a huge potential for harm as it’s a really asymmetric power dynamic.

It's not an argent against javascript but against enabling javascript by default.
Forms and meta refresh can be pretty great.