Use Javascript or not - Fair use of scripting

Posted On // Leave a Comment
Look around the web and find out the names of successful web applications that don't use JavaScript. I could not find any and I think you wont find any too. It looks we are lost somewhere between making web applications behave like desktop applications and making desktop applications behave like web applications. Talking about the former JavaScript comes into limelight. Are we too much reliant on this script ?


Examples

This site just refused to work without JavaScript on any browser. Don't believe me, check this out ( or turn JavaScript off in your browser and go to facebook website)

It does give you an option of viewing the mobile facebook site ( that i think is lame because why i would want to see a miniature (feature less) site when i am using full big PC to surf)There




There are numerous other examples where the sites refuse to work without javascript and millions of other site like Devexpress  (builds beautiful custom dot net controls) which fail to degrade gracefully without javascript and just fall apart (their site's main menu does not even work and so do many of their controls)


JavaScript Statistics

There are no absolute trends about the use of JavaScript. Some users have scripting turned off. Some browsers don't support scripting but that is minimal left to 5% only in 2008
Date JavaScript On JavaScript Off
January 2008 95% 5%
January 2007 94% 6%
January 2006 90% 10%
January 2005 89% 11%
January 2004 92% 8%
January 2003 89%  11%
January 2002 88% 12%
January 2001 81% 19%
January 2000 80% 20%

source: http://www.w3schools.com/




Ok, i get it .. javascript is holy grail when it comes to dynamic web applications that behave like desktop applications (some call them rich applications) and feature rich user experience. 




Question :Do all browsers old and new have an option to turn off javascript !   
Answer: YES

If there is potential threat of users turning off javascript on their browsers then why do all these sites still use/depend on javascripts. Answer is "Rich Experience" for user and hence more likebility of the site/app. 


Forms
 
Forms are basic building block of collecting user information on any website. An important element of form is input date and time. How can a date picker work without javascript ? Yes, we can have drop down date lists and make them fancy with css but can they match the goodness of a jquery ui date picker. I have even seen sites with conventional date picking drop down lists and a javascript calendar to give lazy users an relief. The reality is we all hate forms. There are thousands of autoform filling plugins for browsers for a reason.
Then comes validation. User dont want to wait for the page to refresh and come up with errors showing mistakes they did previously. Users want to see mistakes pointed out at the same time when they make them, so that they can fix them immediately. Javascript validation libraries comes to the rescue in the form of client side validation. Yes you can validate input on server side and it is recommeded but we cannot ignore client side validation. For today's form its a must.


Ajax & Distributed processing
Javascript gives us power of dynamically reloading content on demand on various parts of the web page without making user ever leave the page. Also, for validation, small calculations we can make use of javascript to use client's cpu power instead of putting load on the server's cpu.


Future
With HTML5 on horizon which provides abilities like storing information on client's machine and use it as small database, the role for client side scripting is growing even more bigger. The use of canvas tag in HTML makes use of javascript to provide inline animation without using third party plugins like flash.


So, Are we using javascipt fairly or overusing it ?
It really depends on how we use it. if you are using javascript for its sleek looks capability and bringing a bling to the site then YES its an overuse (you should use CSS for that purpose) . Other hand, if it solves a logical or design problem then go ahead and use it as much as you need



0 comments:

Post a Comment