views:

506

answers:

12

Background: I'm working on an e-commerce website. It was my original intention to add JavaScript on top of regular html pages, so that users with JS support got the added benefits, but users without it could still use the basic html forms to add things to their cart, to search, etc.

I've run into a few situations though, where there simply isn't a sane way to implement certain functionality in a non JavaScript way.

One example is chained attribute selects on product pages (where the color choices change based on the size chosen, because not all sizes come in every color). Even if I didn't use AJAX, it would still require JavaScript to dynamically change the options.

The only alternatives to JavaScript that I can think of would be:

A. Have an add to cart "wizard" where you have to step through each attribute choice on a separate page (yuck!)

B. Put each size/color variation out as a separate product (and force the customer to wade through the category page to find the color size combo that they want)

...And while both of the above would work regardless of whether the user has JavaScript on or not, they both punish the JavaScript users by restructuring the page and forcing them to use an interface designed for the lowest common denominator.

So the question is, since JavaScript has taken a much larger role in web development than it did a few years back, and the design pattern for an AJAX/JS application/site is so much different now than a 'classic' web design pattern, do we still go out of our way to support non JS users? Or do we say, "To hell with you! Update your browser, turn on JavaScript or go shop elsewhere"?

I'd be interested to see other developer's take on this.

+12  A: 

I think it really depends on your target audience. I work for a company that has several types of websites, some are focused on your avg guy or gal who's into gaming. And our stats show us that the vast majority of these people have javascript enabled.

We also have a site that's focused at developers, and many of these developers won't allow javascript to run on a site unless they trust it. I've seen as many as 20-30% of the browsers on that site don't run javascript.

So it's very subjective.

IMHO, it's very reasonable to use vast amounts of tasteful javascript to enhance an otherwise mundane experience. However, I also think that when possible it should gracefully degrade. This form of degradation isn't too hard to achieve (in most cases) as long as you consider it when you're designing things.

Bryan McLemore
Being able to tell someone who is having a problem to "disable javascript, follow the instructions, and it will just work" is a great temporary workaround so they can get their stuff done and you can actually fix the problem without "the whole site is down! the entire organization is paralyzed!" So: graceful degredation or bust.
Roger Pate
I agree it's very important, of course with some apps, a requirement of javascript just makes somethings more possible. Like google maps.
Bryan McLemore
I completely agree. The best way to approach something like this is to use unobtrusive javascript.
Chad Moran
+1 but don't forget about the budget ;) Sometimes, it's just not in the cards.
Justin Johnson
This is true, but time is the budget mostly. So a huge part of meeting that is making sure you consider degradation in your initial designs. By doing that you can really minimize the impact on your budget
Bryan McLemore
+2  A: 

If you can exclude users that don't use javascript, so this will be some mobile devices, or the truly paranoid, as well as lynx users, and any users not using the version of javascript you write for.

If you are willing to go with that then I would suggest you have a static html page that has some message that javascript is required.

When your javascript is loaded, and the DOM tree is ready then you can replace this message, so it is never seen, with the rest of the webpage.

But, you may want to see how you can get the functionality, even if limited, for non-javascript browsers.

For example, for colors you can use a horizontal dropdown that can work on all but older IE browsers: http://www.alistapart.com/articles/horizdropdowns/

If you want to use javascript to make your life simpler then that may be a poor reason, but, if you are doing a photoshop webapp then you will need javascript.

NOTE I would suggest having it work with and without javascript, as an e-commerce site will want to not exclude any customers, I expect.

James Black
+2  A: 

Much of it depends on your audience. As you said years ago JavaScript was used in a different way, and a bit of an annoyance even. Now with AJAX and increased functionality it's a must, and most people have it turned on.

You could say that someone with Javascript disabled is used to stuff not working pretty regularly, and a small minority.

However, if you're building a site that will be frequented by older computers or people on limited bandwidth (such as foreign traffic) you might want to consider working around them. Also a site that is heavily visited by mobile browsers might be another one to focus on.

Take a look at your analytics and see what the current usage is, and profile your audience to really find out.

Jeremy Morgan
+1  A: 

The best answer will depend on a simple comparison: Estimate the extra money you will spend creating the non javascript alternative site. Estimate the money you will make selling products to your non javascript enabled customers. Compare. If you are a huge shop, then getting sales from that last 2% or 10% of users might be worth it. If you are just one guy, maybe you have more profitable ways to spend your time.

Peter Recore
+4  A: 

I think that supporting non-Javascript users is absolutely necessary for any site aiming at some kind of "normal" target group (i.e. not gamers or techies).

  • There is an increasing number of mobile devices accessing, and trying to parse, normal content.
  • Many corporate networks still block scripting for security reasons - you don't want to lose the occasional employee shopping from work, either.
  • Javascript tends to screw any attempt at accessibility. In my mind, creating sites that are as accessible as possible is a service to our fellow human beings.

I'm not saying I'm lily white on this. I hate replicating functionality that I just managed to achieve in my JS framework in static HTML, or making it degrade gracefully. But I think it still really, really is a must, and not merely a question of profitability. This is something worth investing a bit extra, or putting a bit of unpaid work into.

Pekka
Accessibility is also a service to our fellow robots, e.g. Google.
Stuart Branham
+9  A: 

When it comes to things like Ajax, or any javascript for that matter, I think it's best to:

Plan for Ajax from the start; Implement Ajax at the end -Jeremy Keith

This means Intercept (hijack) links and forms using (unobtrusive) JavaScript making your code degrade well for those that don't have javascript enabled. If you want to show a fancy slider, make it a link that tells the server to show the div when you reload the page and tell your javascript to do something differently when the link is clicked.

These ideas are your safest bet for a functional, but fun website.

jeerose
+1  A: 

... I'd vote for the "progressive enhancement" school of though in regard to JS. Personally I treat JS as proverbial icing on the cake.

vector
A: 

While it seems logical, progressive, simpler, and more efficient to require Javascript for an e-commerce site, you should ask yourself if you are willing to forego x percent of the business that would be generated by non-Javascript users, and weigh that against lower development costs.

The percent of business lost is likely not the percent of non-Javascript users, because a smaller percentage of non-Javascript visitors are likely to purchase goods are services. The percentage of lost business will probably be somewhat less than the percentage of non-Javascript users.

xpda
A: 

In theory, yes; but in practice, no.

In theory it's in the spirit of the web to support hardware and software with a range of capabilities and configurations, scaling site features appropriately.

In practice, even mobile browsers are converging on the sweet spot occupied by the current major desktop browsers. Users on the outside can typically switch to an alternate browser or device in a pinch.

ewg
+6  A: 

The most important non-javascript user is Google. Do not forget that.

Randal Schwartz
+1 http://www.peterbe.com/plog/google-is-blind
therefromhere
A: 

focus on making advanced feature to the large audience is better than spending time to find work around for non-javascript user and ones who use obsolete platform.

bip
A: 

In my opinion there 2 things you have to consider when thinking about using JavaScript on a website:

  • Is Google still able to crawl all the content
  • If some parts of the website are not usable without JavaScript then make a very clear message for the non JavaScript users, why you site is not working for them
Hippo