Is it still bad practice to create a website that relies on javascript?
I know it used to be, but nowadays most browsers support them... Why or why not should I worry about this?
No it is not possible. You can even make a website with HTML only but it doesn't make sense. You need CSS to adjust appearance of your website and JavaScript for animations and interactions.
If we're talking about websites “working” or not with or without JavaScript, a site that is client-side rendered will 100% fail without JavaScript. It is sort of the opposite of “server-side rendered” ( SSR ) in which the document comes down as HTML right from the server.
JavaScript is the universal programming language of the web. In fact, JavaScript is used by 97.6% of all websites, according to W3Techs.
On a public website it's ok to use JavaScript as long as the information that your site contains is still available and usability is still good for people without JS. If you're in a more controlled environment like a companies intranet or something, you can maybe rely a lot more on JavaScript.
Spending extra effort to make a site work without Javascript is becoming increasingly ridiculous when so much of the web breaks when you disable it.
For example, did you know that you can't install Google Chrome when you're using a browser without Javascript? Their "accept and install" button requires Javascript.
You should, of course, use the <noscript>
tag to display appropriate messages to the user that may have accidentally disabled Javascript in their browser. Google places this text at the top of their page via the noscript tag:
You need a JavaScript-capable browser to download this software. Click here for instructions on how to enable JavaScript in your browser.
I admit this was a surprising case when I discovered it, because well... it's Google. And millions of people have downloaded Chrome. But I think it illustrates the point that a site dependent on Javascript is a pretty normal thing today.
Depends on the target audience, but more importantly how you're using JavaScript.
Using it for effects that don't interfere with any actual functionality is usually fine.
If you want to target a broad audience and your website is non-functional without JavaScript, then you may want to reconsider.
No modern, interesting, web application does not use JavaScript. A content-only site might not use it, and any web site should warn the user that JavaScript is required, but it's been a long time since "no JavaScript" made any sense.
Search engines still do not evaluate JavaScript. If you want your site to be indexed, all the content needs to be accessible without JavaScript.
It's not bad practice to rely on JavaScript, but I would say it's bad practice to assume without checking that JavaScript is enabled.
At the very least your website should give the user a nice error if JavaScript is disabled. Ideally, at least the basic functionality (such as text content and images) should still work and JavaScript should enhance it: see Unobtrusive JavaScript.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With