Most sites nowadays use JavaScript, and if you want to offer a fluid user experience it is usually one of the best choices.

However I've noticed that a disturbing amount of websites become practically useless if you disable JavaScript, this is (in my opinion) terrible practice, and terrible design.

Why does this matter?
Most people who will access a webpage will have JavaScript enabled, it is pretty standard these days, However that doesn't mean everyone has JavaScript enabled and you shouldn't overlook these users who are unable to run scripts or just don't want to.

Some other reasons as to why this matters:

  • The website is a lot more dependent on the client:
    Everyone has different Operating systems, different browsers and people update these things at different rates. This increases the chance of failure substantially and this can cause issues if a website relies on a newer JavaScript feature and the user's browser doesn't support it, the website is now useless to the user as they have no way of using your website without changing their browser.

  • The website isn't "failsafe":
    If the website isn't designed to be able to work without JavaScript and if your JavaScript breaks it becomes useless to the user.

  • It's more difficult to maintain:
    This is very dependent on how much you use JavaScipt, but the less a website relies on JavaScript the likely you will have to flip-floping between your serverside script and your JavaScript when you want to change something.

  • It can be resource intensive:
    Depending on what is being done with JavaScript it can be very resource intensive for some users, by putting most of the work into a serverside script the server does most of the heavy lifting, which can cut down on how much resources the user has to use.

Does this always matter?
Short answer: No.

Long answer: There are some cases where it may be difficult, impossible or inefficient to make the website function without JavaScript, a few examples are:
  • A web chat.
  • Content loaded with cURL or equivelant:
    Content loaded over HTTP such as with cURL tends to increase page loading times by a substantial amount, ideally you should try and make it so you request data over HTTP as little as possible, in some cases however this content could be loaded in a frame, rather than with JavaScript.
  • A music or video player*

Obviously this list in in no way comprehensive, but it should give you the gist of it.

What should be done?
I personally develop with my first aim to make the website functional without any JavaScript, once I have a solid website I begin to add various JavaScript and AJAX features to make the user experience even cleaner for users with JavaScript enabled.

A couple things to consider:

  • use the <noscript> tag, this tag allows you to specify content that is only displayed when the user does not have JavaScript enabled.
    <noscript>Please enable JavaScript to get full functionality.</noscript>
    
  • If an element is hidden and then shown with JavaScript add a CSS rule in a stylesheet in a <noscript> tag to display it.
  • If you are using JavaScript to display responsive content, have a look at CSS media queries.
  • Check in your serverside script whether or not the request is AJAX or not and output accordingly, an example of this in PHP is:
    if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
        //AJAX request
    } else {
        //Normal request
    }
    
  • Don't use JavaScript for the sake of using JavaScript. Basically if something can be done without JavaScript, that is often the better way to do it.

TL;DR JavaScript should enhance the experience, it should not be the experience.

Progressive enchantment is a good strategy.

If you have any input or criticism, feel free to comment below.

*Depends on how complicated it is and what support you want, you can make some pretty nifty music and video players with nothing but HTML5
Last edited 12:35 AM (UTC) on 07/09/2016 by Bacon.
avatar
Posted by: Bacon
11/07/2015
[spoil] [hr]
[Close Tags]
21 Comments.
  • avatar
    Guest  
    05/10/2017
    Thank you so much for giving everyone a very splendid opportunity to read critical reviews from this website. It's always very useful and jam-packed with a great time for me personally and my office co-workers to search your web site at minimum 3 times in a week to learn the fresh issues you have. And lastly, I'm so actually happy concerning the astounding knowledge served by you. Selected 2 facts in this article are really the most effective we've had.
  • avatar
    Guest  
    05/10/2017
    I must show my admiration for your kind-heartedness giving support to folks that absolutely need assistance with the subject. Your special commitment to passing the message across has been wonderfully good and has continually made guys just like me to realize their desired goals. The useful report denotes a great deal a person like me and especially to my fellow workers. Warm regards; from everyone of us.
  • avatar
    Guest  
    04/10/2017
    I am also commenting to make you be aware of of the extraordinary discovery our daughter encountered going through your site. She discovered too many details, which include what it is like to have an ideal teaching mindset to get other people easily fully grasp a variety of extremely tough subject matter. You actually surpassed people's expectations. Many thanks for churning out those powerful, trusted, revealing not to mention unique thoughts on the topic to Julie.
  • avatar
    Guest  
    04/10/2017
    Thanks so much for providing individuals with such a pleasant possiblity to read from this site. It is often very pleasing and also full of fun for me and my office fellow workers to visit your website minimum 3 times in 7 days to find out the latest guidance you have. And definitely, I'm always pleased considering the special points you serve. Selected two tips in this posting are without a doubt the most impressive I've ever had.
  • avatar
    Guest  
    01/10/2017
    I am also commenting to make you be aware of what a great experience my friend's child undergone using your blog. She came to understand a good number of details, with the inclusion of what it is like to have a wonderful teaching mood to have the mediocre ones quite simply fully grasp a number of tortuous subject matter. You truly did more than readers' desires. Many thanks for rendering such necessary, trusted, explanatory and as well as cool tips on this topic to Mary.
  • avatar
    Guest  
    28/09/2017
    I'm just writing to make you be aware of of the incredible experience my wife's princess found browsing yuor web blog. She learned plenty of issues, including what it is like to possess a marvelous giving nature to get the rest without difficulty fully grasp a number of multifaceted issues. You truly exceeded my expectations. Thank you for coming up with the necessary, dependable, explanatory not to mention easy tips on this topic to Emily.
  • avatar
    Guest  
    24/09/2017
    I wish to convey my gratitude for your generosity giving support to those people that really need assistance with in this area. Your personal dedication to getting the message across became extremely helpful and has really helped most people much like me to arrive at their pursuits. Your useful help and advice means a lot to me and still more to my peers. Thanks a lot; from all of us.
  • avatar
    Guest  
    23/09/2017
    Thanks so much for giving everyone an extremely marvellous opportunity to read articles and blog posts from this blog. It can be very nice plus jam-packed with a great time for me personally and my office mates to search your site a minimum of thrice in a week to see the newest secrets you will have. And definitely, I'm so always impressed with the surprising knowledge you give. Some 3 points in this posting are in truth the most beneficial we've ever had.
  • avatar
    Guest  
    20/09/2017
    I not to mention my friends ended up going through the great pointers on the blog and so all of the sudden I had a horrible feeling I had not thanked the web site owner for them. All the men were definitely as a consequence glad to study them and already have in actuality been loving those things. Appreciate your indeed being simply kind and for having variety of superior themes most people are really wanting to know about. Our honest apologies for not expressing gratitude to you sooner.
  • avatar
    Guest  
    20/09/2017
    Thank you so much for providing individuals with an exceptionally wonderful opportunity to read articles and blog posts from this blog. It is often so ideal and packed with fun for me personally and my office peers to visit the blog at minimum 3 times a week to read the fresh things you have got. Of course, I'm just at all times satisfied for the superb secrets served by you. Some 1 facts in this posting are rather the most impressive we have had.
  • avatar
    Guest  
    20/09/2017
    I enjoy you because of every one of your effort on this website. My mom delights in going through investigations and it's really obvious why. A lot of people know all relating to the dynamic mode you render good tips and hints through the website and as well as inspire contribution from other people on the concern then our favorite daughter is without question understanding a lot. Have fun with the rest of the new year. You're the one performing a splendid job.
  • avatar
    Guest  
    15/09/2017
    Thanks a lot for giving everyone such a nice chance to read in detail from this blog. It really is very cool and stuffed with amusement for me personally and my office colleagues to search the blog at the very least three times in 7 days to see the new guides you will have. And lastly, I'm so actually amazed with all the good ideas served by you. Certain 3 tips in this post are indeed the most beneficial I've had.
  • avatar
    Guest  
    26/06/2016
    hey there guys my name is peteer griffen hehehhhehehehee
    • avatar
      Guest  
      18/09/2017
      I'm just commenting to make you be aware of of the magnificent experience my girl obtained studying yuor web blog. She realized lots of pieces, which included what it is like to have a wonderful teaching mindset to make folks with ease grasp several multifaceted topics. You really surpassed our own desires. I appreciate you for displaying the good, healthy, informative as well as unique tips about that topic to Ethel.
  • avatar
    Guest  
    29/03/2016
    WHAT'S UP?
  • avatar
    Guest  
    29/03/2016
    HI BACON
    • avatar
      Author  Bacon  
      16/04/2016
      Hello "Guest"
      • avatar
        Guest  
        17/09/2017
        Thanks a lot for giving everyone such a terrific opportunity to read articles and blog posts from here. It really is so enjoyable plus stuffed with fun for me personally and my office mates to visit your website at least three times per week to study the newest tips you have. And of course, I'm always contented with your mind-boggling advice you give. Some 3 ideas in this post are clearly the simplest I have had.
    • avatar
      Guest  
      17/09/2017
      Thanks a lot for providing individuals with remarkably marvellous opportunity to read critical reviews from this web site. It is often very terrific and as well , stuffed with a good time for me personally and my office friends to search the blog the equivalent of 3 times per week to study the new guides you will have. And of course, I'm actually fascinated for the good guidelines you serve. Certain two tips in this posting are in fact the most suitable I have ever had.
  • avatar
    Guest  
    30/10/2015
    hi