JavaScript is used all over the internet to accomplish a wide variety of features such as hover menus, rollovers, animation, and form validation. In fact, JavaScript is used so frequently that web developers often take it for granted, without realizing that not all browsers support it. Yes, that’s right, not all browsers support JavaScript. And if that isn’t bad enough, many web surfers actually disable JavaScript.
If you’re wondering why anyone would disable JavaScript, take a look at our list below.
Clearly, there are many good reasons an internet users would opt to disable JavaScript in their browsers. And while estimates aren’t too accurate, somewhere between 5 and 7 percent of internet users disable JavaScript. That means that at least 1 in every 20 visitors might not see your website as you intended. So it is important to ensure that your website works properly with or without JavaScript.
Fortunately, other internet technologies can accomplish most of what you would probably use JavaScript to do:
Believe it or not, you don’t need JavaScript to create a hover menu! Stu Nicholls, an impressive CSS/XHTML developer at CSSPlay.co.uk, shows the possibilities of CSS with at least 100 different kinds of CSS menu examples. (Feel free to peruse the rest of the CSS Play website. In addition to menus, there is a wide collection of other amazing CSS accomplishments.)
Sometimes, however, you might want to create a cool effect which is only possible with JavaScript. In this case, feel free to create the JavaScript menu, but pay special attention to how the menu behaves without JavaScript. Be sure that it can still be used to navigate your website.
Believe it or not, this too can be accomplished by CSS by using the ‘:hover’ state to shift the position of an element or show a new element. Either way, rollovers are rarely crucial to the usability of a web page.
Fortunately, there are alternatives for these as well. When you use JavaScript, it is always processed on the client-side, which is why users are able to modify the behavior of the web page when they turn it off. Instead, you can opt to do all of your processing on the server-side, by using a programming language. For example, our contact forms use server-side validation to ensure that a valid email address has been entered, even though this could be accomplished with JavaScript. By opting for server-side processing, your users will always be subject to certain restrictions.
Similarly, you can use a programming language, such as PHP or ASP, to redirect users to other web pages.
For animation, there are two alternatives: (1) create an animated gif image, or (2) use flash. Both of these methods have their drawbacks. With the animated gif image, you are limited to creating an image with a reasonable filesize. (The longer the animation or larger the image, the larger the filesize.) And finally, if you opt to use flash, you will encounter some of the same problems you encountered with JavaScript: Not All Visitors Enable Flash. And like the animated gif, you are likely to have some filesize issues as well.
As for pop-ups, we’re at a loss. Instead, you will have to bait your users to click on a link which would open in an external window or tab… (Let us know if you’ve found suitable alternatives.)
So if you are building a website, you are free to use JavaScript. But its should only be used on elements that are not crucial to the use of your website. And if, for some reason, JavaScript is essential to the use of an element on your page, consider supplying some alternative text explaining what the element is and that users need to turn on JavaScript to take advantage of it.
Tags: browsers, cross-browser compatibility, JavaScriptTrackback URL for this entry:
http://www.velvetblues.com/web-development-blog/reason-to-limit-use-of-javascript/trackback/
Contact us today for a quote. Click here to submit details regarding your project.
If you are making a general inquiry, send an email to info@velvetblues.com