Should you design websites that require JavaScript in this day & age?

后端 未结 30 1084
醉酒成梦
醉酒成梦 2021-01-11 11:04

It\'s fall of 2008, and I still hear developers say that you should not design a site that requires JavaScript.

I understand that you should develop sites that degra

相关标签:
30条回答
  • 2021-01-11 11:40

    Independence from Javascript and graceful degradation are important to an application despite the actual demographics -- because such an application probably has better software design.

    The "human user without Javascript" may be purely hypothetical (for example, if you're trying to make money with your product). But designing for that hypothetical user encourages modular software design which will pay off as you continue to develop your app.

    Javascript provides functionality. HTML provides data (on the page itself, and via links that point to more data). As a general rule that reaches well beyond browser apps: A well-designed software product will separate data from functionality. All data should be available, and the functionality should be a separate layer that consumes the data.

    If your Javascript is creating data at runtime, then it's time to get specific and figure out whether your webpage really is a piece of software (e.g. a mortgage calculator) or whether it's a document containing data (e.g. a list of mortgage interest rates). This should tell you whether it makes sense to rely on Javascript.

    As a final note/example, demographics can be misleading. Relatively few humans browse your site without Javascript, but lots of machines (search bots, data miners, screen readers for the disabled, etc.) are browsing your site without Javascript. Again, the distinction between data and functionality are important -- the bots are just making requests and looking for data in the responses. They don't need functionality. But if your user needs to invoke functions just to make your data accessible, the bots are getting no value from your site.


    One side point about the screen readers and other accessibility considerations for the disabled. This is an important niche demographic: a mind that navigates data in a human way, but who can only get data from your site in the same way machines get it. By providing data cleanly and semantically on your page, you make it available to the largest possible set of accessibility tools.

    Note this doesn't exclude Javascript from consideration. Our mortgage calculator example can still work: accept input from the user, invoke Javascript, and write the output back into the clean semantic data layer of the page. Screen readers can then read it! And if they can't, you're encouraging the development of better screen readers that can.

    0 讨论(0)
  • 2021-01-11 11:40

    You should be tying the functionality of your website to your audience. That being said, every modern browser (save for the mobile platform) includes javascript, and so unless your audience includes luddites with decade old computers, you can assume they have javascript.

    The people you need to worry about, then, are those that specifically turn it off. This includes:

    • Corporate networks with tough security (not common, but some financial and defense institutions)
    • Paranoid web-heads

    So, first, who is your audience? Are there other websites that are comparable to your target? Look at their site and success - do they degrade gracefully, and would yo be satisfied with their level of success?

    If you are targeting mobile applications, though, you can't guarantee javascript.

    -Adam

    0 讨论(0)
  • 2021-01-11 11:41

    Two simple questions to help you decide...

    1. Does using javascript provide some core functionality of your site?
    2. Are you prepared to limit your potential users to those who have JS? (ie. Most people)

    If you answer yes to both of those, go for it!

    Websites are moving (have moved?) from static pages of information to interactive web applications. Without something like Javascript or Flash, making compelling user interactions is sometimes not possible.

    0 讨论(0)
  • 2021-01-11 11:42

    Some corporate environments won't allow Javascript, by policy or by firewall. It closes the door to one avenue of virus infection.

    Whether you think this is a good idea or not, realize that not everyone has full control over their browser and it might not be their choice.

    0 讨论(0)
  • 2021-01-11 11:45

    A related question was asked on our very own Stack Overflow blog: http://blog.stackoverflow.com/2008/06/is-it-ok-to-require-javascript/

    0 讨论(0)
  • 2021-01-11 11:46

    In terms of client software consider users/customers who are using a browser that supports some but not all Javascript. For example, most mobile phone browsers support a bit of Javascript but nothing very complicated. The browsers on devices such as the Playstation 3 are similar.

    Then there are browsers such as Opera Mini, which support a lot of Javascript but are operating in an environment where the scripts are running on a server that then sends the results to a mobile device.

    0 讨论(0)
提交回复
热议问题