DEV Community

Discussion on: Why your website should work without JavaScript.

Collapse
 
stephenwhitmore profile image
Stephen Whitmore

Serious question: What do you recommend for js apps? Do you stick a bunch of stuff between noscript tags? Do you steer clear of js apps entirely and stick with server-side rendered content? With the prevelance of React, Angular, and Vue there doesn't seem to be a clean way to accommodate both users of "webapps" and those who choose to go without js completely. Is it all one way or the other?

Collapse
 
shadowfaxrodeo profile image
Nathaniel

Depending on the app, the first thing you can do is server-side render it with next.js and nuxt.js for vue. That way at least the static content of the pages is rendered and all the links still work. You can host a server-side only version of Next.js on Netlify (i think).

For dynamic content if it's not too complicated, you can stick all the inputs in a form. Then, if javascript isn't present, the user is redirected to a server-rendered version of the content. That's what i'm doing here. But that's very simple application that rolls dice. If javascript isn't present the dice are rolled on a server. It uses the same code on both the client and server side.

There are some things you just can't do without javascript — for those situations all you can do is leave a polite note in a <noscript> tag explaining what's happened.

But most of the web isn't or shouldn't be like that. It's weird that you can't use twitter without javascript — it's mostly just text.

That's my guess anyway, I'm only just starting to learn about this stuff.

Collapse
 
stephenwhitmore profile image
Stephen Whitmore

I appreciate your detailed response. It's clear from your article and your responses that you've put quite a bit of thought into this topic. I have mixed feelings about it to be honest. On one hand I love the power and capabilities of js and on the other I hate how reliant the web has become on it in recent years. Plus the potential for privacy violation it brings is a huge downside too. I get why many in the FOSS realm hate it.

I'm glad you brought this topic up. It's good to regularly question conventions and expectations otherwise we all fall into the trap of "we do things this way because this is how we do things". It's something I see a lot of in many aspects of life and I hate it.