Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it still bad practice to build a website that relies on javascript?

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?

like image 966
Will Du Avatar asked Feb 18 '11 02:02

Will Du


People also ask

Can you build a website entirely with JavaScript?

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.

Should my website work without JavaScript?

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.

Are most websites built with JavaScript?

JavaScript is the universal programming language of the web. In fact, JavaScript is used by 97.6% of all websites, according to W3Techs.

Is it OK to use JavaScript?

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.


5 Answers

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.

enter image description here

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.

like image 78
Steve Wortham Avatar answered Sep 30 '22 15:09

Steve Wortham


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.

like image 20
Jamie Wong Avatar answered Oct 04 '22 15:10

Jamie Wong


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.

like image 21
John Saunders Avatar answered Oct 02 '22 15:10

John Saunders


Search engines still do not evaluate JavaScript. If you want your site to be indexed, all the content needs to be accessible without JavaScript.

like image 24
zwol Avatar answered Oct 01 '22 15:10

zwol


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.

like image 22
EMP Avatar answered Oct 01 '22 15:10

EMP