Jump to content

Javascript Usage


chronister

Recommended Posts

Hello,

 

I have a question for you folks.

 

I have very little experience with Javascript. I have not needed it  on any largescale project yet. I have also avoided using it for core functionality of my sites. If a user accidentally had JS disabled in their browser, my sites still work.

 

I am noticing a big trend in websites using Javascript and if it is turned off, then you can't use the site...

 

Is JS considered so standard now-days that it is commonplace to assume that it is going to be available? What are the best practices concerning using javascript, do you build 2 sites? 1 flashy js rich app, and then a plain vanilla HTML site?

 

What do you folks do?

 

Thanks,

 

Nate

Link to comment
Share on other sites

My personal preference is to build the core functionality without javascript/ajax and then in an unobtrusive way add the js functionality needed. Beyond the core functionality I say "If you disable javascript, change font sizes, ect then you know there could be problems with advanced features." If they change something locally that is beyond my control and I will not support such changes. I compare it to disabling css.. No one is going to be able to support anything like that. So, as a general rule I do not support users without javascript enabled except for the core basic functionality.

Link to comment
Share on other sites

I'm mostly in agreement with tomfmason. Whenever possible the JavaScript should only be used to "enhance" a page. It should not be a requirment to use the page.

 

For example, form validation is a great use of javascript. Of course, there should already be validation on the server-side. But also having validation on the client-side helps the user by not having to submit a form with bad data. If done correctly, JavaScript validation can be added so that it does not affect those with JS disabled.

 

however, there are some times when you want to add some functionality that necesitates JS. But, in my opinion, the predominance of JS enabled browsers means that very, very few users woud be restricted.

Link to comment
Share on other sites

Noscript, one of the more popular firefox add-ons, disables javascript. Quite a few people have it these days (including myself).

 

-------------------------------------------------------------

 

The secret to javascript is 'unobtrusive javascripting' (google it for more info). I personally build my sites entirely in php. There is almost nothing that can be done with javascript that can't also be done with PHP + a page load. So I build the functionality with PHP, then I overlay javascript over top the page. The only javascript reference on my pages are the link in the header, no other javascript is visible anywhere.

 

As a result, everything will work whether the user has javascript on or off. Poeople who have it off can not even tell that something is not working. If there are buttons that require javascript to work, and have no way of building the same functionality with php only, I hide them in the initial XHTML, and then make them appear upon page load using javascript.

Link to comment
Share on other sites

Ok, so it sounds like my initial mindset of JS for fluffy enhancements only, not for core functionality was correct.

 

I am working with a company to set up online ordering (I am web developer/IT for a 60+ pizza chain) for our company and their site is developed in a way that if you don't have JS turned on, it won't work. I don't particularly like that, but how much of a concern should I make of it.

 

I have had a mindset that if 1 person can't use my site then I have not done my job.

 

It sounds like from the 3 that replied, you have the same type of mindset. A site should not break because JS is turned off.

 

Thanks for your help.

 

Nate

Link to comment
Share on other sites

I have had a mindset that if 1 person can't use my site then I have not done my job.

 

It sounds like from the 3 that replied, you have the same type of mindset. A site should not break because JS is turned off.

 

In my opinion that is a business decision. I have worked on projects where JS was a necessity in order to deliver the functionality necessary. It is up to the stakeholders to determine if whatever functionality currently exists through JS is important enough that the site may exclude a small number of visitors.

 

What will that number be? It's difficult to say. According to the stats posted on thses sites:

http://www.thecounter.com/stats/2008/April/javas.php

http://www.w3schools.com/browsers/browsers_stats.asp

 

approximately 93%-95% of browsers used have JS enabled. However, many of the non-js browsers will be mobile devices and or readers. So, the real number of actual visitors to your site with JS enabled may be slightly higher. Of course, it would be easy enough to gather your own statistics based upon your actual visitors.

 

With a site for a Pizza chain, I don't see any reason that JS would need to be required though.

Link to comment
Share on other sites

In my opinion that is a business decision. I have worked on projects where JS was a necessity in order to deliver the functionality necessary. It is up to the stakeholders to determine if whatever functionality currently exists through JS is important enough that the site may exclude a small number of visitors ...

 

approximately 93%-95% of browsers used have JS enabled.

 

With a site for a Pizza chain, I don't see any reason that JS would need to be required though.

 

Let's take all that at face value, then rearrange and paraphrase it.

 

If we could make a change that increased sales by 5-7% would that be a good business decision?

Link to comment
Share on other sites

Let's take all that at face value, then rearrange and paraphrase it.

 

If we could make a change that increased sales by 5-7% would that be a good business decision?

 

Did you see my last sentence? In this case, a web site for a Pizza Chain is only a marketing piece and in my opinioin there should be no reason that JS should be a requirement. But, you assertion that possibly restricting 5%-7% of users would translate into 5%-7% of lost sales has no basis (how many sales originate through the site, either directly or indirectly? What is the ratio of visitors to the site vs. orders?, etc., etc.). There are many factors that would influence the actual "costs" of lost sales. In any event, I agree that it would be a poor decision for any type of marketing site.

 

But, I still maintain that there are some instances where requiring JS is valid. Particularly with "application" sites that require vast amounts of real-time functionality. In these situations the provider is sellign the use of the site as software to the end user. Requireing JS is no different than having minimum system requirements printed on the side of the box for a retail software application.

 

In a previous company I worked for we provided a desktop publishing application via the web for the commercial printing industry. I won't say it would have been impossible to do it w/o JS, but the additional work it would have put on the user would made it an un-marketable product.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.