Online Documentation Server
 ПОИСК
ods.com.ua Web
 КАТЕГОРИИ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 


 ПОДПИСКА

 О КОПИРАЙТАХ
Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.




Previous Table of Contents Next

Java is not only a language for creating applets that run on Web pages, but rather a general purpose language that can create stand-alone applications. That is, you can create any application with Java, without any connection to the Internet or the World Wide Web. The classic example for a stand-alone application written entirely in Java is HotJava, the Web browser created by Sun Microsystems. On the other hand, JavaScript is not a stand-alone programming language. Like most scripting languages, JavaScript is interpreted and thus requires a specific application to run it. JavaScript currently works with Netscape Navigator, Microsoft Internet Explorer, the LiveWire server environment, and plug-ins. JavaScript applications will probably never function independently.

Java requires an appropriate multitasking operating system. Therefore, anyone running Unix platform, OS/2, Windows 95, Windows NT, or Macintosh should not have a problem viewing Java on the Web. Nonetheless, Windows 3.1 or Windows 3.11 users cannot benefit from Java because that operating system does not support multitasking. As opposed to Java, JavaScript’s audience is not limited due to any operating system. Windows 3.1x users can enjoy JavaScript-enhanced pages exactly like other users. That is obviously a major benefit of JavaScript over Java. Not only Windows 3.1x users are missing Java—some users running multitasking operating systems cannot run Java applets from a Web page. This happens when a user is connected via a proxy server that disables Java due to possible security flaws.

JavaScript and Java are Complementary Languages

We have spoken with many people who believe that JavaScript is a scaled down version of Java. As you should already know, that is far from being correct. JavaScript cannot perform many tasks that Java can, whereas Java cannot do most things that JavaScript is capable of doing. As of Netscape Navigator 3.0x, JavaScript and Java can interact together using LiveConnect (see Chapter 31).

JavaScript’s Current Status

JavaScript is currently under development, and will probably stay that way. The language specification is not complete yet. Each browser release introduces new features to the language. Therefore, you must take special precautions when creating scripts for the general public. First of all, you must follow the rules that enable you to hide the code from browsers that do not support JavaScript. Secondly, if the script works only on some JavaScript-enabled browsers, you must take that into consideration. You can use all versions of JavaScript to find out which browser the user is running, enabling you to provide a script compatible with the browser being used. If you implement this technique, you can avoid all errors by disabling the script if it is not compatible with the user’s browser. In any case, you must assure that the user does not receive any annoying JavaScript errors that are an indication of a poorly designed Web site. The fact that JavaScript is under development has immense influence because the language is an interpreted language, not a compiled one. When using a compiled language, you must use an up-to-date compiler so it can compile your code. However, once the program is compiled, it will run on any machine with the designated operating system. Another related problem with JavaScript is that it is interpreted by a different interpreter every time. For example, it can be interpreted by Netscape Navigator 3.0 and Microsoft Internet Explorer 3.0. Therefore, your script must be suitable for all browsers, or at least the most popular ones. This problem is specific for JavaScript, not for all interpreted languages. For example, when you create a CGI script via Perl, you must only make sure that the Perl interpreter installed on the server meets the script’s needs. If so, it will work for any browser that supports CGI (more than 99.99% of all browsers).

JavaScript is supported by many companies. At the same time Netscape Communications and Sun Microsystems announced JavaScript, more than 28 companies also announced that they would be endorsing JavaScript as the open scripting standard for the Internet, and many companies indicated that they were considering licensing the technology to include it in their own products.

The Future of JavaScript

JavaScript is perceived to advance in two vectors. The first one is in the direction of “serverless” CGI scripting. Small databases of information will be embedded in an HTML document and processed by JavaScript scripts. Cutting the server-client communication will sharply reduce the response time, which is still the number one problem in surfing the Internet. The second vector is pointing to Java applets. As applets become more and more powerful, more exciting opportunities will be available to use JavaScript to assemble existing building blocks.

As ActiveX and VRML become more powerful, JavaScript will work in concert with them, resulting in very powerful applications. JavaScript, a cross-platform language, is currently in use alongside many other languages. Among those languages are Java and some VRML. Furthermore, it has many other uses, such as automatic proxy setting scripts. In the future, other programs and languages will feature interaction with JavaScript. For example, Netscape is currently using JavaScript with LivePayment, a program that enables a Web site developer to receive immediate payments over the Web.

Motivation Summary

A Web page designer cannot afford to ignore JavaScript, because his competitors will not, beating him in Web design competition. Nevertheless, JavaScript has its limits and cannot perform every task. A few classic JavaScript-based solutions are as follows:

  • User interaction with form elements (input fields, text areas, buttons, radio buttons, check boxes, and selection lists)
  • Distributing small collections of database-like information with friendly interfaces to that data
  • Processing the data on the client side before submission to the server
  • Animation and live image swapping

This list is obviously an abbreviated one and does not include all possible uses of JavaScript.

Previous Table of Contents Next


With any suggestions or questions please feel free to contact us