This page is a starting point for anyone interested in interactivity and everything related with linking programs to the Web pages. It is not an exhaustive coverage but tries to point to some of the advantages and drawbacks.
With certain knowledge of HTML you are able to create your home page, and then you' can link to diferent and interesting resources on the Web. But maybe you want to give users the ability to interact with one another, in that case CGI scripting may be what you want, and you might want to also look at the combination of using CGI scripts (which are housed on a server) with local ("client-side") scripts (which run off the Web browser on the user's computer) using JavaScript. Besides calling up external applications, the new generation of Web browsers supports display of external documents (not just HTML) within the browser window itself. This allows integration of HTML-based textwith a variety of other documents. To use the Netscape plug-ins, you need to download the appropriate plug-in for the program you want to view and for the platform you are using. But it is possible to write your own plug in for further customization of your Netscape window: this is possible with Java. Java applets can be written to do just about anything you could imagine and are slated to be supported by a variety of Web browsers.
CGI provides a means of extending the capabilities of HTML by allowing the WEB designer to writte custom programs that interact with web pages to do more complex things. A CGI program is a file that resides on the web server that the server runs in response to something inside the web page. With it you can:
A CGI program is executed in real-time, so that it can output dynamic information . It is an interface between external applications and information servers.
The Web execute it, so that, the program should not take too long to process, otherwise, the user will justbe staring at their browser waiting for something to happen.
The steps done for a CGI script are:
Three examples of CGI made in the department are Protoengine and the Libraries without Number and the riddles machine.
The first one is a word search algorithm in a database which a particular format. The output of the program is mainly statistics about the keywords searched, presented as tables. The search algorithm is able to look² for keywords, regular expresions and more than one word a time.
The second one one is a gateway for data collection: The form is able to send the data the user put in it to a determinated place, where is stored. People who want go to that conference fill in the form, which is sended directly to an email address. The structure of the email is similar to the one which can be seen in the Web, so it can be easily stored.
The riddle machine consists in two distinct parts:
The perl program that manages de data and displays the output and the html document,
where the user inputs de data and see the results displayed.
The program access to a document stored in the server,choose one random riddle and
four random answers, where only one is
the right one. This CGI program reads the user answer and the correct answer and c
ompare them. Displays the results as options to continue or give up playing.
CGI is most complex than most Web authors are interested in, and it doesn't support all of the visually fancy things authors want to include in their pages. This can be possible with Java.
Among the diferent tasks can be done with Java:
Before Java, for viewing a graphic, playing a movie, or listening to a sound file on the Web, it was necesary a helper application installed on the computer and connected to the browser (an independent program unrelated to the browser). Whenever a particular file (movie, sound, or whatever) was retrieved from the Web, the helper would be run to display or play back the file. If you didn't have the necessary helper, you had to find it, download it, and install it. Java handles these things internally. No helper applications. No CGI programming. All you need is a Java-enabled browser and the Java Developers Kit (freely available from Sun's Java Home Site, http://java.sun.com). And the Java programs (called applets or mini-applications) will run on any Java-enabled browser on any platform: Macintosh, Windows, or UNIX. You don't need to create a program for each machine type. One size fits all.
Java applications, or applets, are different from ordinary applications in that they reside on the network in centralized servers. The network delivers the applet to the system that request them. Although applets appear to be integrated into the Web page displayed, they are actually independent programs and in fact Java can be used to create programs divorced from Web pages. Java applets are not part of the HTML which displays the page, although some parameters of Java applets may be set through the use of HTML.
Applications created in Java can be deployed without modification to any computing platform, thus saving the costs associated with developing software for multiple platforms. And because the applications are stored on centralized servers, there is no longer a need to have people insert disks or ship CD's to update software.
The platforms that Java runs Sun are has Sparc and X86 Solaris, Windows NT for Intel, Windows 95, MacOS 7.5 on PowerMacs and 68020, 68030 and 68040 Macs.
Another kind of Web scripting much simplier that Java in applications where forms can be processed by the Web browser on the user's local computer, without recourse to a server at all is JavaScript . Based on the Java language, JavaScript extends the capabilities of Netscape Navigator and is easy for anyone who can compose HTML. JavaScript is used to glue HTML, inline plug-ins, and Java applets to each other. Java must be compiled (translated into computer code) before running. JavaScript on the other hand functions as an add-on to HTML and appears as text alongside familiar HTML codes; JavaScript code is interpreted and run by the Web browser when a user retrieves the Web page, it does not need to be compiled into a program.
Advantages of scripting:
Disadvantadges of scripting:
So which is better CGI or browser scripting? It depends. The best may be to find the right tool for the purpose we have in mind. For some self-testing ,for example, JavaScript would be worth looking into faster, network-independent and more flexible in providing feedback to the user, as in a sample quiz (requires Netscape Navigator 2.0 or other browser with JavaScript interpretation) which illustrates different kinds of feedback (through messages in form field, in an "alert" window and in a frame window). JavaScript provides richer and more varied interactivity, approaching that possible through programs such as Authorware or HyperCard. On the other hand, for any kind of formal assessment over the Web, it is needed access to a server and use of a CGI script. The best of all is two have both available.
Another possibility is to send "cookies" (another Netscape innovation) containing, for example, encoded answers which can then be processed locally when the JavaScript page is run.