SD Webworks  
< Home > - About - Members - Activities - SD Webworks - Get Involved

    

 Sustainable Development Communications Network

Java and JavaScript

By Neal Thomas, updated by Duane Taylor
January 2001

User experience on the Web is often enhanced through the use of interactivity. There is a broad spectrum of technologies available to developers who want to implement greater interactivity in their pages. Two such technologies are Java and JavaScript.

Java is a full programming language that allows for an application to be written once and run on many different platforms. It can be used to write anything from games to spreadsheet programs to whole operating systems. Programs written in Java will run on computers regardless of the operating system.

Often confused with Java is the computer scripting language JavaScript. JavaScript allows for enhanced interactivity within the browser without requiring any special plug-ins and without resorting to the use of Java, which is often cumbersome. The combination of HTML and JavaScript allows authors to offer rich interactive experiences to their users without requiring them to wait while Java applications are compiled to run on their machines and without having to wait while a browser plug-in downloads and installs.

For example, JavaScript can be used to enhance navigation. Instead of using static buttons to indicate different parts a web site, graphics used in combination with JavaScript allow for "rollovers"—buttons that give visuals cues when a mouse pointer is over them. Or JavaScript can be used to create drop-down menus—lists of available Web pages that are compact but expand to multiple options when clicked upon. JavaScript also reveals technical information about a visitor's browser, optimizing the page for their given operating system or screen size. Essentially, JavaScript allows the programmer to access the inner workings of the browser to offer more functionality for users than would be possible using basic HTML and graphics.

As with all technologies related to Web design, it is important to stay focused on users. Programmers should determine that they are using JavaScript elements because it enhances the user's experience, not because it looks good. Every element added to a page takes time to download.

It is important to also realize that JavaScript poses limitations. Not all browsers contain JavaScript functionality, and while most do (notably Netscape and Internet Explorer), some users choose to turn off JavaScript functionality for security reasons. JavaScript has contained bugs in the past that, in specific circumstances, can compromise private information entered into the browser's preferences (such as one's name and e-mail address).

If JavaScript is indeed used, it is important to offer non-JavaScript alternatives. This is particularly critical when it comes to site navigation. For example, if drop-down menus are offered to users, it's vital that there is a non-JavaScript alternative available so users without JavaScript do not face a dead end.

This web site is managed and designed by:
The International Institute for Sustainable Development | http://www.iisd.org