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

Extending HTML

HTML is a very limited document-formatting language. It is based on tags which instruct the browser how to display a chunk of text or an image. As such, the HTML is limited to a static, one-way interaction with the user. The Web page can be as sophisticated and attractive to the surfer’s eyes as it can possibly be, but the user cannot interact with the page. Interaction cannot be static—it requires constructs such as if statements and for loops, which are not part of the HTML syntax.

These missing constructs are found in JavaScript. This object-oriented language provides Web page authors with the power to reach a very high level of interaction between the user and the document. The power of the language is best witnessed from the pace of its evolution. Browser providers are coming out with new extensions and features every few months, leapfrogging each other in their constant quest for market dominance. The leading browser-provider companies are thus setting the standards in Web page authoring features, with JavaScript being of special importance.

CGI Programs

You are probably familiar with popular search engines such as Yahoo!, Infoseek, AltaVista, and Excite. Have you asked yourself how these engines work? They are based on CGI (Common Gateway Interface) scripts. CGI extends the interaction between the user and the document to a higher level where the document communicates with the Web server on which the Web pages reside. When you click the Submit button on Infoseek’s form, your browser sends your entries from the HTML form to the server, where the CGI script processes the data and sends it to another program running on the server. The results are then transmitted to the user’s browser.

CGI scripts can be written in any language, Perl and C being the most popular ones. Objectively, Perl and C are more complicated to program than JavaScript, and therefore CGI scripting is usually mastered only by experienced programmers.

You are now in a position to understand why search engines need such powerful machines to run their devices. A typical search engine receives several million requests per day. For example, suppose a provider needs to answer one million search requests per day. A simple calculation shows that that server must process approximately ten one-second-long requests per second. Each of these ten requests is a CGI script executing on the server.

Helpers, Plug-ins, Applets, and CGI

Web page authoring consists of several layers. The more powerful the layer is, the more complex it is to program. The fundamental layer is HTML. As we have explained earlier, JavaScript extends HTML to a dynamic user-page interaction. Helpers, plug-ins, and applets extend JavaScript’s capabilities even more.

Helpers

Browsers are very powerful in converting HTML tags into attractive pages, as well as interpreting JavaScript scripts to animated commercials, but have some deficiencies in other areas such as understanding audio that comes in from a Web site. Your browser, though, is smart enough to use helper applications to do such jobs instead. The conversion of digitized sound to audio you can hear through your speakers is done by a program that resides on your hard disk and is launched by the browser.

Plug-ins

Another way to extend browser capabilities is by plugging an application into it. SmartSketchAnimator is an application from FutureWare Software, Inc. that displays a vector-based animation as efficiently as a .gif file. The disadvantage of the .gif file is that the user cannot interact with the detailed artwork. With FutureWare, the graphic object can be customized in such a way that a specific portion can appear highlighted when the user clicks on it. At this stage we will not discuss plug-ins, because a full chapter is dedicated to these mechanisms and their powerful connections with JavaScript.

Java Applets

OK, so you have tried HTML, JavaScript, helpers, and plug-ins (in this order) and you are still not satisfied with your Web page. There is still a rotating globe you want to place at the bottom left corner of your page. Sun Microsystems has answered this need by developing a language for the Web called Java. Talented programmers can use Java to build small applications (applets) that are downloaded to the browser upon hitting the appropriate page and then automatically discarded from memory when a new page is loaded. The applet concept is similar to the image file concept. As the .gif file is being loaded upon hitting the page which calls the appropriate image, so is the applet being loaded upon the browser’s request. The applet, though, is more than a static combination of pixels; it is an independent program which executes when the page loads and is automatically terminated when the page unloads. The applet is a self-sustained, independent module, without any possibilities for user interaction during its execution.

The classic example for an applet is a scrolling LED banner, similar to the scrolling sign at Times Square. There is no better way to inform your visitors about changes you have made to your page. You can change your banner whenever you want to bring new items to the user’s attention. This touch of animation can bring your page to life and create the perception of a dynamic, up-to-date one.

For a browser company to support Java applets, it needs to license the technology from Sun and build the proper hooks in the browser. The first one to do it was (you guessed right) Sun itself, with its HotJava browser. Netscape incorporated it later and so did Microsoft. Java applets are assets that people are accumulating, and every browser must support them to live up to the nonstop competition.

You have probably asked yourself about the origin of Java. The Java language is derived from C and C++ and is targeted for the more experienced programmers among us. Therefore, many Web page authors and casual programmers cannot adopt the language as easily as they have adopted HyperCard, ToolBook, or Visual Basic. JavaScript was created to answer this exact need.

CGI (Common Gateway Interface)

There are some tasks that cannot be accomplished by the browser on the client side. Building a common database for an engineering department must rely on a server accepting data and requests from all users and storing it for future access and processing. Such an application can be written in C, C++, Perl, or any other language. The communication protocol between the server application and the client browser is called CGI. You should buy a book on CGI if you intend to learn it, because it is far beyond the scope of this book and is very difficult to learn without detailed documentation.

Previous Table of Contents Next


With any suggestions or questions please feel free to contact us