5 ms·
I used to think this. I even used uMatrix (RIP) to disable all JS. After a while though, it simply wasn't worth it. You'll have a vocal minority on HN of JS dis
by cercatrova 4y ago
I used to think this. I even used uMatrix (RIP) to disable all JS. After a while though, it simply wasn't worth it. You'll have a vocal minority on HN of JS disablers, but the truth is most people don't know or care about JavaScript, much less want to disable it. So, it's really not worth catering to this 0.2% or even 1% of people as the article cites.
There are just too many interesting things JS can do. I've been playing around with Three.js and it's been incredible the types of 3D art you can create. I want to make those experiences for users which is simply impossible without JS.
However, I will also say that most of the websites I do make will work without JS because I use Next.js as a server rendering framework, plus CSS can handle a lot of things these days, such as modals, link trees, etc that used to require JS and I use those where possible.
What I will not do though is re-implement logic just for JS disablers. A particular example is using an animation library like Framer Motion that works with JS. It is somewhat possible to achieve similar effects in CSS, creating your own spring function in SCSS for example, to interpolate between values, but I'm not going to do that because it's effectively double the work for 1% of the users. Even the 1% figure is misleading for production apps if you use TypeScript (to prevent JS breakage) or modern dev practices like distributed CDNs (to prevent a package from getting loaded).
- oblak 4y agoI am a js disabler who writes js for a living. "Apps" are hard without js. Not worth it and I do not expect anything complex or interactive to work. Stuff like HN and news/forums function just fine without, though. And that is great.
- tbran 4y agoI agree. Javascript can do cool stuff. When the author said: > I'd prefer to write js all day — but finding html and css only solutions has made me a better developer. > It's forced me to find creative ways of solving problems — and to learn new html and css features. ...it made me think about how you can often do cool thing by taking advantage of some browser functionality, then you look it up on caniuse.com and it's only available on 75% of browsers. Much worse than using a few lines of JS that can't be used by 1% of users.
- deleted 4y ago[deleted]
- onion2k 4y agoI'm not going to do that because it's effectively double the work for 1% of the users. This implies that if you only did the CSS version you'd do the same amount of work as the JS version but it would work for everyone. Why wouldn't you do that? Doing only the JS version means you spend the same engineering effort but it doesn't work for as many people. Choosing to do that when you have a choice makes absolutely no sense.
- graftak 4y agoThe usual suspect for js style manipulation are animations, and because css animations have all sorts of limitations where you will likely run into so it's more convenient to use the same js tooling for animations almost everywhere.
- cercatrova 4y ago> A particular example is using an animation library like Framer Motion that works with JS. It is somewhat possible to achieve similar effects in CSS, creating your own spring function in SCSS for example, to interpolate between values, but I'm not going to do that because it's effectively double the work for 1% of the users. > > Doing only the JS version means you spend the same engineering effort but it doesn't work for as many people Where did I say it would be the same engineering effort? I explicitly said it's more for the CSS version. In my example, the CSS version is inferior to what the JS library can already do. Creating a spring animation is only one of the things that Framer Motion can do in JS built in. If I did everything in (S)CSS I would basically be re-implementing Framer Motion, which, as I stated, is double the work for <1% of users. Why would I want to re-implement a package when it's already there for me to use? So yes, it "absolutely makes sense" to do everything in JS only.
- yellowapple 4y ago> Where did I say it would be the same engineering effort? Saying "double the work" implies the doubling to be total - i.e. the Framer Motion approach and the SCSS approach are each 100%, and doing both would therefore be 200% or double. What you're saying now would be more accurately described as "triple the work" - i.e. Framer Motion would be 100%, SCSS would be double that (200%), and the total would be 300% or triple.
- capitainenemo 4y agoI don't know much about your particular use case, but in my experience implementing an animation in CSS results in a smoother animation with better GL acceleration in the browser resulting in a lot less CPU/battery consumption. So. There's that. But otherwise I'm broadly in agreement. If you're making an online application, it pretty much requires JS. Not so much for CRUD db form apps/forums/blogs/wikis etc.
- bearmode 4y ago>Not so much for CRUD db form apps/forums/blogs/wikis etc. If you want decent/custom FE validation you do still need it
- capitainenemo 4y agoI assume "FE" means "form error" - personally I agree with you, but you can still make it work without it.. "progressive enhancement" where validation is still done serverside which is an absolute must even if you do use JS for that. Also, HTML5 validation is pretty darn powerful these days. Check it out if you haven't already.
- easrng 4y agoProbably "front end". But yeah, you can do a lot with just html and css.
- robalni 4y agoI don't care how many people there are that care about whether they are running javascript. The problem persists even if 0 people care about it. The problem is that people are getting abused, even if they don't care about it. They are unknowingly lending their computers to unknown people who use them as their tools by running code on them. My computer is my tool and nobody else's. If website owners think it's totally fine to run code on my computer when I visit their site without my permission or knowledge, I wonder what they would think if I ran code on their servers without their permission or knowledge. That would be fair. My computer for you and your computer for me.
- connordoner 4y agoUnless you want to go down the ultra-pedantic route that HTML is markup rather than code, why are you reading HN?
- robalni 4y agoThe difference between HTML and Javascript is that it's much harder to use peoples' computers for arbitrary things through only HTML. With Javascript it's done all the time. I don't know what this has to do with me reading HN but I can add that HN works without Javascript which is something more websites should do so we can get rid of the expectation that you have the right to run arbitrary script code on peoples' computers when they just want to read a page of text.
- krapp 4y agoYou do have the right to run arbitrary script code on people's computers. That's been a fundamental part of what the web is and what it is capable of for over 20 years. You, as a web developer, publisher, what have you, have the right to write whatever code you want, even to render text, just as you have the right to design your own page layout, choose your own fonts and colors. It's up to the user agent to decide whether or not to run the code.
- 4y ago
- pyuser583 4y agoI have a medical disorder which could one day render me blind. I worry about how much of the web I will be able to use. Don’t JS free web pages have better accessibility?
- Tajnymag 4y agoAs long as the underlying DOM uses the correct semantics, there shouldn't really be a great difference. One can write a static page that would be less accessible than a js heavy alternative. Screen readers nowadays work with the rendered page DOM, not the raw html.