Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This question already has an answer here:

Should I bother to develop for JavaScript disabled?

I feel that my time is better spent developing for the majority.

share|improve this question

marked as duplicate by gnat, Kilian Foth, Jalayn, MichaelT, Jim G. May 28 '13 at 12:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

8  
Very good question. –  Simon P Stevens Dec 13 '10 at 13:50
13  
Your time would be better spent building a working site, and that includes supporting disabled javascript as much as possible. –  Anna Lear Dec 13 '10 at 13:50
3  
I personally browse most sites with JavaScript disabled. –  TokenMacGuy Dec 13 '10 at 14:47
4  
ah, @TokenMacGuy, may I ask why? –  Jiew Meng Dec 13 '10 at 15:08
2  
Even if you are developing something that must rely on javascript you need to remember that even flawless javascript can overwhelm smaller devices/browsers. As more devices get the ability to browse the web I think web developers are going to have to rely less on javascript not more. –  Bill Dec 13 '10 at 16:18

20 Answers 20

up vote 46 down vote accepted

There's a web-design philosophy known as Progressive Enhancement which is one you should consider. The idea is you build a basic site that is usable and workable, and then you layer onto this enhancements like jQuery and browser-specific stuff to "enhance" it. This way you get a site that works for everybody and looks nice for the majority.

If that doesn't convince you, then consider other reasons for having a site work without javascript:

  • It is more SEO friendly. If your site relies on JS for content and links then chances are search-engines will be ignoring large chunks of it.

  • Imagine you are an eCommerce site selling widgets. Now, even if only 5% of your customers disable javascript, that is a potential sales loss of 5%. Is it worth losing customers over?

  • Don't discriminate against the disabled. Relying on javascript means your site is not accessible and, in some cases (such as government/public sector sites), you could be breaking the law by discriminating against people.

share|improve this answer
7  
Yes, in the UK it is law that disabled people should not be discriminated against and this is something all public-sector (government funded) websites have to adhere to. See direct.gov.uk/en/DisabledPeople/RightsAndObligations/… and rnib.org.uk/professionals/webaccessibility/lawsandstandards/… –  Dan Diplo May 12 '11 at 10:10
14  
Relying on javascript does not mean the page is not accessible. Screen readers are perfectly capable of running javascript, and there are standards for accessibility in rich web applications. w3.org/WAI/intro/aria.php –  Russell Leggett Jan 16 '13 at 7:44

It depends very much on your target market. If your target market is non-techs, you're pretty safe ignoring javascript disabled. However, if you're after techies, well, the majority of the ones I know have javascript disabled... You're going to need to support them unless you want the small portion of techies that allows javascript (I'm one of the minority, I let javascript run on my machines). :-)

share|improve this answer

Depends on the answer to a single question:

"Is the cost of supporting users with Javascript disabled greater than or less than the money lost by not supporting those users?"

Say your website has a lifespan of 3 years before needing to be rebuilt, it costs £30,000 to build for 'rich clients', and you add another £10,000 to support non-javascript users (of which we'll assume there are 5% of)

If the missing 5% of users would have spent more than £10,000 - do it. If they wouldn't, don't do it unless you're legally required to.

This is more of a business/economical decision than a technical one.

share|improve this answer

Can I recommend an article from "A List Apart"?:

Progressive Enhancement with JavaScript

...We’ve reviewed the mindset needed to implement progressive enhancement in JavaScript and several techniques through which to do it. We’ve also touched on the concept of unobtrusive scripting and learned a little about how to manage the inter-relationship of CSS and JavaScript.

When you combine the general approach with that article with useful tools like JQuery (or Prototype, or whatever your JavaScript framework of choice is), it's really trivial to apply the JavaScript behavior after the fact.

There are several types of browsers out there that still do not have JavaScript or at least very limited JavaScript support. Not to mention that rule #1 for both WCAG and section 508 compliance (accessibility for non-US folks) is that the sight does not depend on a scripting language to function. If the page reloads every time I make a change, but it still allows me to make changes it is functioning. The AJAX layer on top of the base site makes it possible for me to do the same without the page reloads.

Top reasons I can see for supporting no JavaScript users are:

  • Supporting folks with disabilities (screen readers, alternate input devices, etc.)
  • Supporting security conscious people: let's face it there's bad people doing heinous things with JavaScript, so the easiest solution is to get rid of JavaScript
  • It's the easiest way to disable ads without a plugin
  • Mobile and embedded devices
  • Command line browsers used to download tools on headless servers
  • Search engine spiders only follow real links--JavaScript confuses them

Please, if you are going to require cookies and JavaScript on your site for it to function, then properly do your due diligence to avoid the following problems with the following:

  • Cross-site scripting attacks
  • 3rd party user tracking
  • Hacking/Defacement through DOM manipulation
  • Phishing (if a script can access your DOM, it can send any information on the page to the server it was loaded from)

(And that's just the short list)

When the solution isn't that hard, why not do it?

Also, while you're at your JavaScript fiesta, don't forget to support sane keyboard navigation.

share|improve this answer

Most of the answers here appear to highlight criticisms of standard websites using JavaScript in non-essential or hacky ways. But what about web apps? There are a ton of critical functions that cannot be achieved even remotely as effectively without JavaScript. Even something as simple as a basic word counter under a text area, or enabling/disabling an additional form question based on the answer to another. In this case is it not reasonable to build for the majority and degrade gracefully for the minority? Especially if you know that your user base is non-technical and unlikely to have JS disabled?

share|improve this answer

JavaScript disabled is extremely important and you should support it. The porn industry is notorious for spamming users with rogue pop-ups. Disabling JavaScript is pretty much required if you navigate into this territory.

Do you really want to force users to constantly turn JavaScript on/off as they go from sites of questionable repute to your app?

share|improve this answer

< 5% of users disable javascript

According to BrowserStatistics, in 2008, only 5% of users had JavaScript turned off. The trend has steadily been declining so it's very safe to assume that now near 2011, that number is much smaller.

Downgrade Gradefully

Your site should never be broken - no matter if the users have JS on or off. Even if it's as simple as displaying a message that your site needs javascript turned on, you should make sure that your website renders and behaves in an acceptable, non-broken manner for those select few.

Reworking for non-JS users? Normally: No.

The ordinary developer has no need to create a non-javascript version in another language. However, if it is known that your clients have anti-javascript needs, then you obviously are forced to cater to it. (Even GMail has a no-JS version)

share|improve this answer

As a developer I no longer worry about 1% of users who turn off Javascript. It is too time consuming and development time is too expensive to waste on such nonsense. AJAX saves an incredible amount of bandwidth which turns directly into $$$ savings, which makes profits higer. If I lose oneor two potential users of the site for every 100 users, those one or two lost users will cost a lot more in development than the potential income of they could ever bring in.

Try turning off Javascript and logging into Facebook, it becomes a very broken website after that. If it's good enough for Facebook, its good enough for me.

share|improve this answer
3  
I totally agree with you. One small issue though: you should have some sort of warning message for the user if he's part of those 1 or 2 percent. Maybe he unintentionally disabled JS. –  Radu Murzea May 28 '13 at 12:54

Yes.

I'm not going to talk about people with NoScript, embedded devices, etc. Their share can be measured and then you can decide if revenue decrease caused by annoying e.g. 0.5% users worths implementing a solution for them.

But there are other reasons to follow Progressive Enhancement principle, and they are often more important.

  1. 100% users can't execute javascript before scripts are loaded. If site can work without js, it can be loaded faster for the first-time visitors, visitors with empty cache and for all visitors after js code updates.

  2. Sites that can work without js are more reliable. Javascript error breaking a website is an architectural nightmare. More info on this and related problems: http://isolani.co.uk/blog/javascript/BreakingTheWebWithHashBangs

  3. It is easier to stick to Progressive Enhancement than to implement SEO-friendly javascript-only site.

  4. It is easier to write automated tests for site that doesn't require javascript to work.

It is actually quite easy to follow Progressive Enhancement principle so why don't follow it?

share|improve this answer

Why would you use JavaScript? It's not necessary for anything useful anyway. Add it for silly effects if you want, but make it work for us sitting on a new but slow netbook/iPod/whatever wanting it to work a little faster (and safer) by turning of JavaScript!

share|improve this answer

My thoughts:

Using javascript will always increase the surface area for attack, not just for you, but for your customers - almost everyone I know browses with NoScript, and this includes non-technical folks.

If I see an online shopping site that uses javascript badly I will not buy from them. I always first browse with javascript disabled, and if a site degrades gracefully I may be interested. If it is just broken I will usually assume the programmers also don't have the capability to deliver a secure shop platform.

It tends to slow everything down - despite being close to a major city, my broadband is slow enough without having to wait for some marketing idea to load. If a site takes more than 5 seconds to load basic content then I won't bother unless I have a real need.

share|improve this answer

On a site like this you will find many developers tell you how they have Javascript disabled so you should support progressive enhancement. In reality of the 5% of people who have Javascript disabled, 90% of them are developers and other tech geeks, they are not the general public. Most major sites do not support progressive enhancement. Have you tried to use Facebook without Javascript? They basically say go away.

share|improve this answer

No, you shouldn't

With two exceptions:

  1. Content you want to be search engine indexable. (That doesn't mean it has to look good - as long as the links work and the content is discoverable.)
  2. Simple mobile sites that must work on all devices. (Some BlackBerries have JS disabled by default, and many non-smart phones often don't have it at all.)

For desktop and touch phone websites, Javascript provides an amazingly rich user experience. There is a reason all top websites make extensive use of AJAX and Javascript. All current browsers support it. Embrace it!

As someone who has sweated in the past to make an entire website work with Javascript disabled, I can assure anyone that they'll end up degrading the experience for the 99% in order to please the 1%.

Rather just stick in a NOSCRIPT tag that tells those users to enable Javascript. They'll be used to it.

share|improve this answer

It depends on the site and who will be using it.

Is the site public or is it an intranet or a site that will only be available to certain customers? You will probably encounter users without JavaScript in the public. If it will only be used by clients can you tell them you only support JavaScript enabled?

Is SEO a consideration or is the entire site behind a log-in screen or SEO is it otherwise not a factor? It is much easier to optimize for search engines if there's no JavaScript.

Will the site ever be used on mobile browsers? Mobile browsers often have no or poor JavaScript support.

You should also realize that JavaScript can make it difficult for screen readers to process your site and has other potentially negative accessibility considerations.

Users of text based browsers (e.g. lynx) also have little or no JavaScript support.

You have to look at your site and your audience and decide if you need to support users who have JavaScript disabled. You also have to see if it's even possible not to use JavaScript. If you're making an advanced Web Application and need things like webcam and microphone support it may be impossible to not use JavaScript.

If you decide that you need to support users without JavaScript then you can still use JavaScript. You should just make the website still functional without it. This is called progressive enhancement, it should gracefully degrade if there is no JavaScript support.

If you decide to require JavaScript you should notify your users (using the <noscript> tag) that you are doing so.

share|improve this answer

Things to consider:

AFAIK, search engine spiders don't like Javascript. You should have basic content and navigation without Javascript just for SEO.

Some websites may have rules for access by the disabled, either for legal reasons or for company policy. That is usually best accomplished with simple HTML as opposed to Javascript.

While most people surf with Javascript on nowadays, that isn't a guarantee for the future. The web is becoming increasingly hostile, and tools like NoScript may become more popular. Alternately, it's possible that more people will use devices with less capable browsers, although with some Android phones being fairly inexpensive this seems less likely. Graceful degradation may be a way of future-proofing the site.

share|improve this answer

For one, I disagree with the people out there who insist that everything should function without Javascript. It is nice to code to the lowest common denominator in a lot of cases (for example, I would be really pissed if my bank's site required Flash or some such nonsense.) But realistically almost everyone has Javascript enabled these days and if used properly the resulting sites can be quite spectacular and useful! (I mean, let's see how nice Google Maps is when Javascript is turned off...)

However, this should not absolve you from at the very least ensuring that your page fails gracefully if Javascript is not present. Never EVER leave your users staring at a half loaded, broken page with no indication as to what went wrong. Just ask yourself: Would I rather spend 2 minutes coding up a "This page requires Javascript" message or receive 10 emails daily from users telling me that my page is broken because they have noscript enabled?

share|improve this answer
21  
"But realistically almost everyone has Javascript enabled these days"... And those who don't are well aware what they're getting themselves into. –  Dan Ray Dec 13 '10 at 22:01
2  
Be sure to consider your target audience. If your target is tech-savvy, security conscious people a much larger majority of your readers will be running NoScript. If they are like me, when they hit a site through a search link and that site offers nothing useful without javascript, I immediately hit Back and look at the next site on the list. –  Zan Lynx Sep 30 '11 at 20:41
2  
You should also consider the contents of your website. A website focusing on displaying data doesn't need Javascript, but I've yet to see a game working without it. –  Niphra Jan 16 '13 at 9:00

Only on mission critical functionality

Generally its a good idea to "degrade gracefully". However I would I would only concentrate on mission critical parts of your web application, to cater for situations when JavaScript may not be available.

If its just "bells & Whistles" effects, then no don't bother. People who deliberately surf with out JavaScript will just have to make do a plain experience (hey that's their choice for not using Js)

share|improve this answer

Yes, you should.

If you perceive this as something that requires extra effort, you may be doing it the other way around.

Develop your pages to work without JavaScript first then add JavaScript-based improvements, Ajax effects and so on. They will work if JS is supported/enabled, otherwise your pages will degrade gracefully.

And please, don't develop the pages where:

  1. The entire content is pulled from the database by JavaScript

  2. The markup completely falls apart because the elements glued together and put into the right places by JavaScript not by CSS

  3. Links in the navigation and in the body are not functioning without JavaScript (unless it's some framework like ASP.NET which relies on JavaScript for a reason)

It's just against the spirit of the web and against the common sense.

P.S. Spoken by a user of the NoScript.

share|improve this answer
16  
So instead of delivering features for the 99% of people with javascript turned on, I should bust my hump making everything either: not use javascript, or worse, do everything 2 ways so it gracefully degrades? I feel the same way about turning off cookies. It's almost 2011, you should expect sites to be pretty much broken without javascript. –  Hardwareguy Dec 13 '10 at 14:25
30  
No, in 2011 I actually expect JS-broken sites to be finally fixed. –  user8685 Dec 13 '10 at 14:32
14  
I think the onus is more on you as a noscripter to decide if a site is worth turning on javascript than for the sites to bend over backwards for the minority. –  Hardwareguy Dec 13 '10 at 14:35
6  
Well if you're relying on JS where you don't in fact need it, you're doing it wrong. As good time as any to start doing things right. –  user8685 Dec 13 '10 at 14:47
8  
+1 for developing first without JS, then adding enhancements. This has been the proper way to create web sites for ages. If your site doesn't work for the base case (a simple browser like one might find on the old computer your grandmother uses, the mobile you use, and the search indexer a large search provider uses), you really don't have any idea when you might be losing views/sales. Developing for no JS isn't difficult. No JS users don't need all the flashy animations and rounded boxes, but the site better work. –  PeterL Dec 14 '10 at 0:43

Personally I use the NoScripts Firefox plugin when browsing, and I encourage others to use it to. On all the family PCs I maintain NoScripts is one of the mandatory bits of software I install. I set it up with a whitelist of the basic email and banking websites along with the popular social & video sites and explain to them how the temporary allow works. Judging from the popularity of this plugin I think there is a pretty good portion of people who use it.

At the very least I expect navigation functionality to work without scripts. If you have something specific like video that requires scripts then fine, but display a nice placeholder that says "scripts are required to view this video".

Making your navigation rely on scripts is a big mistake though. In many cases it will make me bounce off the site in disgust. An even bigger mistake is to have part of your site or navigation just completely disappear when scripts are disabled. Unless you highlight the fact that something is missing there's a good chance I won't even notice so will just leave your site thinking it wasn't there. Also, a full screen message that just says "this site requires scripts" won't get you very far, I need to see some level of content before I trust you enough to allows scripts.

Finally, don't forget that it's not just desktop PCs that are browsing your site, but mobile browsers are increasingly popular. Although mobile JavaScript support is getting better it's no where near perfect so unless you are going to heavily test all the different mobile browsers I would suggest you search the mobile version of your page pretty much scriptless.

share|improve this answer

Absolutely

A site that doesn't work correctly without JavaScript should clearly notify the user. As much as possible should be made to work correctly without JavaScript. There are certain cases where this won't be possible, highly dynamic sites built on layers of AJAX and remote fetches are one of them. This doesn't mean that it's okay to show a blank page if I have JavaScript disabled.

Graceful degradation is extremely important, and it doesn't just apply to JavaScript, it applies to everything you code. Valid HTML markup, valid CSS, server side validation of everything.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.