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 8:22 PM (UTC) on 29/10/2018 by Bacon.
avatar
Posted by: Bacon
11/07/2015
Please Login or Register to comment.
36 Comments.
  • avatar
    Guest  
    19/06/2020
    Thank you a lot for providing individuals with such a special opportunity to read critical reviews from here. It is often so nice and jam-packed with amusement for me and my office co-workers to search your site at least thrice per week to see the newest tips you have got. And lastly, we're usually satisfied for the unbelievable suggestions you give. Certain 1 facts in this post are particularly the most suitable we've had.
    jordan 4 http://www.jordan4.us.com
  • avatar
    Guest  
    19/06/2020
    I'm commenting to make you know of the cool experience my wife's princess had browsing yuor web blog. She came to understand a wide variety of pieces, which included what it is like to possess an ideal helping nature to get many others with no trouble completely grasp a variety of multifaceted subject areas. You truly surpassed her desires. Thanks for rendering such informative, dependable, revealing and also cool tips on your topic to Kate.
    yeezy boost 350 http://www.yeezyboost-350v2.us.com
  • avatar
    Guest  
    16/06/2020
    Thanks for your whole work on this site. Debby really loves working on investigations and it's easy to see why. Many of us know all concerning the powerful mode you create practical tricks via this website and as well as strongly encourage participation from website visitors about this issue while our own child is undoubtedly starting to learn a lot. Take advantage of the remaining portion of the new year. You are doing a fabulous job.
    curry 7 shoes http://www.curry7.net
  • avatar
    Guest  
    16/06/2020
    Thank you for all your valuable effort on this web page. My mum really likes doing research and it is simple to grasp why. Many of us hear all of the compelling tactic you convey informative information on the blog and as well strongly encourage response from other ones on this concept so my simple princess is undoubtedly being taught a whole lot. Have fun with the rest of the new year. You have been performing a fabulous job.
    <a href="http://www.jordansshoes.us.org" >jordan shoes</a>
  • avatar
    Guest  
    16/06/2020
    I want to point out my gratitude for your kindness supporting visitors who must have guidance on this one theme. Your very own dedication to passing the message all through appeared to be incredibly functional and have in every case permitted women just like me to achieve their ambitions. This valuable help and advice implies so much to me and still more to my office workers. Many thanks; from everyone of us.
    christian louboutin outlet http://www.christianlouboutinoutletofficial.com
  • avatar
    Guest  
    16/06/2020
    I would like to show my gratitude for your generosity giving support to folks that need assistance with this one issue. Your special commitment to getting the message up and down has been unbelievably functional and have all the time made girls just like me to achieve their endeavors. Your important key points can mean a great deal a person like me and even further to my peers. Thanks a ton; from everyone of us.
    hermes belt http://www.hermesbelts.com
  • avatar
    Guest  
    15/06/2020
    I enjoy you because of all of the work on this web page. Kate take interest in making time for investigations and it's obvious why. All of us hear all of the powerful medium you render very helpful secrets by means of your web blog and welcome contribution from website visitors on the situation so our simple princess is without question understanding a lot. Take pleasure in the rest of the new year. You're the one doing a splendid job.
    hermes belts http://www.hermesbelts.com
  • avatar
    Guest  
    15/06/2020
    I want to get across my love for your kindness giving support to all those that need assistance with your topic. Your real dedication to getting the message all over became wonderfully powerful and have really encouraged those much like me to realize their goals. Your amazing helpful facts indicates this much to me and much more to my colleagues. Thanks a lot; from everyone of us.
    hermes handbags http://www.hermes-handbags.us.org
  • avatar
    Guest  
    11/06/2020
    Thanks a lot for giving everyone an exceptionally superb possiblity to read critical reviews from this blog. It is often very terrific and as well , jam-packed with a good time for me personally and my office mates to search the blog a minimum of three times in a week to learn the new stuff you will have. And indeed, we are at all times happy with the staggering information you give. Certain 3 ideas on this page are in fact the most effective I've had.
    kyrie 6 http://www.kyrie6.org
  • avatar
    Guest  
    10/06/2020
    I wish to point out my passion for your kind-heartedness for folks who actually need guidance on this one area of interest. Your very own dedication to passing the solution all around was wonderfully helpful and have consistently permitted women just like me to get to their pursuits. Your amazing informative publication implies a lot to me and extremely more to my colleagues. Regards; from each one of us.
    supreme outlet http://www.supremesoutlet.us.com
  • avatar
    Guest  
    10/06/2020
    Thanks a lot for providing individuals with a very superb possiblity to read critical reviews from here. It's always so beneficial and as well , full of a lot of fun for me personally and my office peers to search the blog on the least three times per week to see the fresh things you will have. And definitely, I am also actually happy with your eye-popping inspiring ideas you give. Some 2 tips in this post are really the most efficient I have ever had.
    yeezy http://www.adidasyeezys.us.com
  • avatar
    Guest  
    10/06/2020
    I have to express my affection for your kind-heartedness giving support to those people that must have guidance on your niche. Your special dedication to passing the solution across became astonishingly informative and have in most cases empowered individuals like me to achieve their goals. The helpful instruction means a great deal to me and especially to my office workers. Warm regards; from all of us.
    <a href="http://www.supremes-clothing.com" >supreme clothing</a>
  • avatar
    Guest  
    09/06/2020
    I'm also writing to let you be aware of what a remarkable encounter my child obtained browsing your site. She came to understand numerous things, including what it's like to have a marvelous giving heart to let many people very easily know precisely a variety of tricky issues. You truly exceeded our own desires. Thanks for delivering the precious, safe, informative and even unique guidance on the topic to Julie.
    yeezy shoes http://www.yeezysshoes.us.com
  • avatar
    Guest  
    09/06/2020
    I have to get across my admiration for your kind-heartedness giving support to folks that have the need for help on this one area of interest. Your special commitment to passing the solution along became pretty invaluable and has specifically permitted some individuals just like me to get to their aims. The useful tips and hints means much a person like me and even more to my mates. Many thanks; from all of us.
    golden goose sneakers http://www.goldengoosesneakers.org
  • avatar
    Guest  
    08/06/2020
    I must express my passion for your kind-heartedness in support of people that really need help with the idea. Your personal dedication to getting the message throughout had become especially invaluable and has without exception encouraged those just like me to realize their aims. Your entire valuable guidelines denotes much a person like me and even further to my office colleagues. Regards; from everyone of us.
    balenciaga shoes http://www.balenciaga-shoes.us
  • avatar
    Guest  
    08/06/2020
    Thank you for your whole effort on this web site. My mom loves going through investigations and it is obvious why. A number of us notice all of the compelling tactic you offer priceless items through this web site and as well as attract response from people on that concept while our own girl is really understanding so much. Enjoy the remaining portion of the new year. You are always carrying out a stunning job.
    goyard http://www.goyardhandbag.us
  • avatar
    Guest  
    06/06/2020
    I have to point out my love for your generosity for people that really want help with the subject matter. Your personal commitment to getting the solution across appeared to be amazingly informative and have in most cases enabled guys like me to reach their pursuits. Your amazing warm and helpful tutorial implies so much a person like me and extremely more to my fellow workers. Thanks a lot; from everyone of us.
    michael kors outlet http://www.michael--korsoutlet.us.org
  • avatar
    Guest  
    06/06/2020
    I must point out my respect for your kindness for men and women that should have help with this one niche. Your special dedication to getting the message up and down had been quite useful and have without exception permitted girls much like me to arrive at their objectives. This useful information signifies so much a person like me and substantially more to my fellow workers. With thanks; from each one of us.
    adidas superstar http://www.adidassuperstar.us.com
  • avatar
    Guest  
    05/06/2020
    Thank you for all of the efforts on this web page. My niece really loves carrying out investigation and it's easy to understand why. My partner and i notice all of the powerful ways you create vital information by means of this website and invigorate response from other individuals on this content while our favorite daughter is undoubtedly discovering a whole lot. Take pleasure in the rest of the new year. You are doing a terrific job.
    converse shoes http://www.converseshoesoutlet.com
  • avatar
    Guest  
    05/06/2020
    I wish to convey my appreciation for your kind-heartedness for men and women that have the need for guidance on this one concern. Your very own dedication to getting the solution across came to be really helpful and have specifically made guys and women just like me to reach their desired goals. Your amazing interesting key points denotes a lot to me and extremely more to my office workers. Warm regards; from all of us.
    nike air max http://www.air-max.us.com