by David Blankenbeckler
The Web browser is the vehicle by which you will be able to share your Java applets. With the Internet craze of the past year or two, almost everyone has used a Web browser. However, you may not be fully aware of the features available in the latest Web browsers and the differences between the two most widely used browsers, Microsoft Internet Explorer and Netscape Navigator.
This chapter describes the key functionality of the most common Web browsers and covers the following topics:
The first Web browsers were much simpler than the popular, feature-rich browsers that companies such as Microsoft and Netscape have developed. In fact, the first Web browsers were designed for scientists who wanted to exchange information with colleagues. Those early browsers simply supported text and hyperlinks; they did not offer multimedia features such as the active content enabled by Java.
Tim Berners-Lee and the other founders of the Web could not have guessed the widespread mania their point-and-click Web interface would create. This type of interface allowed nontechnical users to gain access to the wealth of information being exchanged over the Internet. The essential function of the first Web browsers was to simply read special HTML files from other computers (Web servers) on the Internet. These HTML files had two components:
The special HTML codes, or tags, would tell the browser how to format the text to allow for such things as bold and italics. Additional HTML tags would tell the browser to treat certain words as links to other HTML files (hyperlinks), which could be on the same computer or any other computer attached to the Internet. Listing 25.1 shows an example of a very simple HTML file.
Listing 25.1. An example of an HTML file.
<HTML> <HEAD> <TITLE>An HTML Example!</TITLE> </HEAD> <BODY> This is a very simple HTML file. </BODY> </HTML>
HTML stands for Hypertext Markup Language. HTML is an open specification that is maintained by the World Wide Web Consortium (W3C). For a more detailed discussion of HTML, refer to Chapter 26, "HTML and Web Page Design." For more information about the W3C, refer to http://www.w3.org/.
The protocol that allows Web clients and servers to communicate is known as HTTP, or Hypertext Transfer Protocol. In order to understand HTTP, you also need to understand TCP/IP-a discussion that is beyond the scope of this book. The following are some resources for more information about TCP/IP and HTTP:
TCP/IP Unleashed from Sams.net Publishing
Teach Yourself TCP/IP in 14 Days from Sams.net Publishing
http://www.cis.ohio-state.edu/hypertext/information/rfc.html, the Web site of the Internet Architecture Board, the definitive source for the standards of TCP/IP
http://www.ietf.cnri.reston.va.us/, Internet Engineering Task Force, which designs and develops protocols for the Internet
Web browsers have "learned" to do much more than simply display text and hyperlinks. As a matter of fact, some industry watchers predict that Web browsers may soon become the primary software interface on computers, replacing the operating systems of today.
The popularity of the Internet has fueled severe competition for the Web browser market. The competition is so fierce that hardly a day goes by without an announcement about a new browser feature or a new business deal concerning one of the key browser vendors.
The primary contenders in this struggle are Microsoft and Netscape. This rivalry has been both good and bad for the public at large. The rate at which new functionality has been added has been very exciting, and the fight for market share has reduced the effective price of browsers to zero dollars. However, the rate of change has also spawned many incompatibilities, since the standards-making bodies cannot keep up with the need for new functionality. This has caused confusion and frustration among the users as they unsuccessfully attempt to access content on the Internet.
Netscape Navigator and Microsoft Internet Explorer currently own approximately 90 percent of the browser market. The rest of this chapter discusses the primary features of and differences between these products with an emphasis on topics of interest to the Visual J++ developer.
A useful introduction to the topic of browsers is a discussion of the Internet in general and the browser strategies of Microsoft and Netscape.
No one is surprised that Microsoft's strategy involves migrating the Web browser capability to the operating system itself. Microsoft would like to make Web browsing simply an extension of the operating system. The user would then be able to use Windows Explorer to view his or her local or network file system as well as the Internet.
Microsoft is pursuing its strategy with three key components:
The first part of the Microsoft strategy is to add a new shell extension to the desktop, which would integrate browsing capability with the operating system. Browsing the Internet and your local hard drive may become a unified process.
The second new technology from Microsoft is WinInet extensions. These extensions to the Win32 API give programmers access to the Internet protocols through a simple interface, enabling them to integrate Internet capability into applications with ease. WinInet extensions hide the complexities of TCP/IP and HTTP from the application developer.
The third, and most talked about component of the Microsoft Internet strategy, is ActiveX. Born out of object linking and embedding (OLE), ActiveX is based on the common object model (COM), a component architecture that allows code to be modularized and abstracted in such a way that other programs can use it without having to know anything about the internal workings of the component itself. It essentially delivers the promise of object-oriented programming-reusable code.
The real power and benefit of ActiveX is the installed base of ActiveX components and the use of these components in other development environments. ActiveX components are based on the widely used OCX (OLE custom control) model in Microsoft Visual Basic and Visual C++. These same components are now being positioned as Internet application building blocks. Because a large number of developers are already familiar with ActiveX and because its components are widely available, ActiveX will most likely become a popular and successful Web application development tool. In addition, ActiveX controls can be created in many different development environments, including Microsoft Visual J++, Visual Basic, and Visual C++.
The combination of Microsoft's shell and WinInet extensions along with ActiveX is powerful indeed. In particular, ActiveX will make useful Web applications a reality because ActiveX, unlike Java, has access to the client's resources, such as the file system. Microsoft (and I) believe that being able to access the client's resources is necessary in order for applications to be useful on the Web. A wealth of content already exists on the Web, and it is extremely useful, but interactive applications, such as a word processor or spreadsheet, require access to some of the client's resources if they are to be truly functional.
Of course, any talk of Web applications having access to client resources immediately raises security concerns. What if a rogue application formats your hard disk or deletes important files? The purist response and the road taken by the Java developers was to simply make client resources inaccessible (except in a limited sense through the Web browser). On the other hand, Microsoft has a strategy to deal with this issue. Microsoft's approach to security uses code signing. With this method, the user is warned by the browser when a new ActiveX component that does not have a proper authorization code is being installed. The user then has the opportunity to cancel the loading of the new, unknown software.
In addition to these three key components, Microsoft also supports both JavaScript and VBScript. These scripting languages form the glue that developers can use to integrate the various components of an application. You can use either of these scripting languages to control the objects and applets in your HTML files. In addition, you can use both JavaScript and VBScript for communication between applets and objects. This communication capability will allow cohesiveness between the various pieces that make up a Web application.
The Microsoft strategy has a few problems. The most notable is that ActiveX is platform-specific code. This is in contrast to Java, which is interpreted by the browser and is thus platform independent for any Java-enabled environment.
Netscape's strategy is reflected in its name Netscape ONE (or Open Network Environment). Netscape's position is that Internet applications should be completely open and platform independent. The key components to Netscape's strategy are
Netscape was the first company to recognize and implement Java in a Web browser, and Java is a cornerstone in Netscape's strategy. Java provides the platform independence that is promoted as the solution for Internet applications by Netscape. Inherent in the security features of Java is the inability to access client resources such as the file system. Netscape realizes that this security feature limits the types of applications that can be created and is working with Sun Microsystems to implement code-signing security features for Java applets. If implemented, these security features will provide the capability to grant certain access rights to Java applets that have been cleared by the security system.
Ironically, Netscape also supports native, platform-dependent code in the form of Netscape plug-ins. The interface to the Netscape plug-ins, however, is platform independent. Even though the plug-in interface is platform independent, the plug-ins are compiled to native code and must be developed for each platform that is to be supported. Netscape claims that because the interface is platform independent, to recompile to different platforms is extremely simple.
The purpose of the Netscape plug-ins is very similar to that for ActiveX components-for some applications access to system resources is critical. (Examples of Netscape plug-ins include the RealAudio plug-in and the Apple QuickTime plug-in.) The user will notice two primary differences between Netscape plug-ins and ActiveX components.
The first difference is that the user must install plug-ins manually before using them. An ActiveX component, on the other hand, will be automatically installed, in a process invisible to the user (assuming, of course, that the code-signing check passed). The other difference is that the ActiveX model is based on the widely used OCX model. Therefore, ActiveX components can be used in environments other than the browser, including Microsoft Visual Basic, Visual C++, and Visual J++. As a side note, Microsoft Internet Explorer supports Netscape plug-ins.
Netscape's LiveConnect software layer is the glue that binds the various objects in an HTML document, such as Java applets, Netscape plug-ins, JavaScript, and HTML itself. This layer allows the different objects to work together through the JavaScript scripting language. Microsoft Internet Explorer has a competing interface standard known as COM.
Netscape plans to extend the LiveConnect model by adding support for distributed messaging with the Internet Inter-ORB Protocol (IIOP). The IIOP is part of the common object request broker architecture (CORBA), which is an open standard for connecting applications over the Internet. IIOP will allow Netscape Navigator applications to communicate with other CORBA-compliant network applications.
In order to provide platform-independent access to the client, Netscape has developed its Internet foundation classes. These objects allow Java applets, JavaScript, or other objects to access client services through a platform-independent layer. The first release supports user-interface controls and services. This support provides access to advanced controls that are not part of standard HTML, such as sliders, and supports richer content display, such as multifont text.
Netscape may add the following support to its Internet foundation classes in the near future:
Now that you understand the basic strategies behind the Microsoft and Netscape browsers, you are ready to continue with a discussion of the key features of a Web browser. The section on each feature also highlights any differences in implementation between Netscape and Microsoft.
HTML is the foundation of a Web document and is constantly being improved with additional features. The newest version is release 3.2. Both Internet Explorer 3.0 and Netscape Navigator 3.0 support HTML 3.2. The major new features of this version are support for tables, the <APPLET> tag (which supports Java applets), and the capability for text to flow around images.
Both browsers support additional HTML features that are not yet released by the W3C. In particular, Internet Explorer supports cascaded style sheets, which allow HTML authors to add styles to their documents much as they do in a word processor. Navigator supports the <MULTICOL> tag that allows the author to create multiple columns of text without having to use tables.
Both browsers support frames, which are not a part of HTML 3.2. Frames break the browser display into two or more windows that can independently display an HTML document. Each frame has its own scrollbar and can be advanced or moved backward independently. Figure 25.1 shows an example of a frame.
Figure 25.1 : An HTML frame example.
Of course, both Navigator and Internet Explorer support Java applets. The platform-independent nature of Java means that the Java Virtual Machine must interpret the code before it can run on the client platform. Understandably, this requirement creates a performance problem for Java applets. However, the recent advent of just-in-time (JIT) Java compiling reduces the performance hit.
With JIT Java compiling, the Java bytecodes are compiled before being used. The bytecodes have been simplified to the point that the compiling process is very fast. Although this will not provide a performance improvement for code that runs only once, it will significantly speed up loops in the code or code that is called several times.
Both Internet Explorer and Navigator support JIT Java compiling.
As mentioned previously, Internet Explorer supports the use of ActiveX controls. Netscape does not directly support ActiveX controls, but instead supports a third-party Netscape plug-in (from NCompass Labs) that provides ActiveX support. The support provided by NCompass Labs is not 100 percent compatible, however. The incompatibility is created because the NCompass Labs plug-in, ScriptActive, only supports ActiveX controls that are placed in HTML files with the <EMBED> tag. Microsoft, and all of its tools, support the <OBJECT> tag instead. This means that HTML documents that use the <OBJECT> tag will not work with the ScriptActive plug-in for Netscape Navigator. For more information about ScriptActive see http://www.ncompasslabs.com/.
Microsoft Internet Explorer 3.0 supports ActiveX documents. This feature enables a user to view and edit richly formatted documents such as those from Microsoft Excel or Microsoft Word. ActiveX documents are based on OLE documents and work in much the same way. For example, if a user opens a page containing a Word document, the Word toolbars and menus will appear. The user can then view and edit the document exactly as if he or she were actually running Word. The browser controls are available as well, and the user can move to another page at any time. If a user does not have the appropriate application installed on his or her system, ActiveX viewers that allow users to display richly formatted documents are available for many document types. Figure 25.2 shows an example of a Word document being edited in Internet Explorer 3.0.
Figure 25.2 : An example of an ActiveX document.
The ActiveX documents specification is an open standard, and most major application vendors will most likely support it in the near future. Although Netscape Navigator does not currently support ActiveX documents, Navigator 3.0 will launch the appropriate application and open the document. In addition, a plug-in is available from NCompass Labs called DocActive that provides comparable support to ActiveX documents.
Like ActiveX, Netscape plug-ins provide a way for developers to add native code applications to a browser. Both Internet Explorer and Netscape Navigator support Netscape plug-ins.
In order to support LiveConnect, the plug-ins must be recompiled with the SDK (Software Development Kit) provided by Netscape. Microsoft Internet Explorer does not support LiveConnect. Therefore, you will not be able to control plug-ins with JavaScript in Microsoft Internet Explorer. The plug-ins themselves should still work, however.
An example of an interesting plug-in from Starfish Software, called EarthTime, appears in Figure 25.3.
Figure 25.3 : An example of a Netscape plug-in.
Both Microsoft Internet Explorer and Netscape Navigator have a broad array of support for multimedia.
The ability to play back video clips is appearing as a standard feature in the latest generation of Web browsers. Support of video playback is available in varying degrees in both Navigator and Internet Explorer.
Netscape Navigator accomplishes video playback through the LiveVideo feature. (LiveVideo supports only AVI playback at this time.) Microsoft's ActiveMovie provides greater support than LiveVideo does. This ActiveX component currently supports AVI, MPEG, MOV, and QuickTime playback. Figure 25.4 shows an example of the video playback feature for Internet Explorer.
Figure 25.4 : An example of ActiveMovie.
Both browsers support audio playback in the following formats: AIFF, AU, MIDI, and WAV. Microsoft Internet Explorer supports MPEG audio also.
RealAudio provides the ability to receive live broadcast audio over the Internet. For example, many radio stations now use RealAudio to broadcast live over the Internet. For more information on RealAudio, go to http://www.realaudio.com.
Both Microsoft and Netscape support RealAudio through the use of a plug-in. Figure 25.5 shows the RealAudio plug-in.
Figure 25.5 : A RealAudio plug-in.
A browser that supports Macromedia's Shockwave can display interactive multimedia programs created with Macromedia's Director software. This capability is one means of creating interactive games on the Web. To find out more about Shockwave, see http://www.macromedia.com.
Internet Explorer supports Shockwave through an ActiveX control available from Macromedia. Netscape Navigator supports Shockwave through a plug-in, also available from Macromedia (again at http://www.macromedia.com). Figure 25.6 shows an example of the Shockwave plug-in. This example is a game called Galactic Marauders from Matt's Shockwave Spectacular at http://www.onramp.net/joker/Galactic_Marauders/.
Figure 25.6 : A Shockwave plug-in example.
Virtual Reality Modeling Language, or VRML, enables you to create 3D worlds in Web pages. As you might imagine, this language is very useful for creating games on the Internet, but its use is not limited to games. For example, you can design a Web page to resemble a 3D store in which visitors can wander up and down the aisles to inspect the merchandise.
Both Internet Explorer and Netscape Navigator offer built-in support for VRML. (Internet Explorer uses Direct3D and Navigator uses Live3D.) The example of VRML in Figure 25.7 is from Intel's home page at http://www.intel.com/procs/ppro/intro/vrml/mma.wrz.
Figure 25.7 : An example of VRML.
Support for scripting in a Web browser is important because it is the primary means by which the objects in an HTML document are integrated. Two major scripting languages are available:
Both Netscape Navigator 3.0 and Microsoft Internet Explorer 3.0 support JavaScript, a scripting language developed by Netscape. (Do not confuse JavaScript with Java, the programming language.) Netscape originally called its scripting language LiveScript, but renamed it JavaScript to capitalize on the enormous popularity and press coverage of the Java programming language. You can find a detailed discussion of JavaScript in Chapter 27, "Manipulating Web Components Using JavaScript."
The other scripting choice is VBScript. This scripting language was developed by Microsoft and is actually a subset of Visual Basic. VBScript is fully upward compatible with Visual Basic, which is a major competitive advantage because of the large number of developers who are already familiar with Visual Basic. The only browser that currently supports VBScript is Microsoft Internet Explorer. You'll find a detailed explanation of VBScript in Chapter 28, "Manipulating Web Components Using VBScript."
The Java Virtual Machine includes security features that prevent a Java applet from harming or accessing data on the user's computer. For example, Java applets cannot access the user's file system or execute any programs on the local system. This security feature is known as sandboxing because the Java Virtual Machine essentially builds a sandbox in which Java applets can execute. The Java Virtual Machine will not allow Java applets to perform operations outside of this sandbox. Of course, Navigator and Internet Explorer support this standard security model for Java applets. In addition, both browsers provide support for secure communications over the Internet.
Navigator and Internet Explorer provide support for secure communications
through the Secure Socket Layer (SSL) protocol. SSL 2.0 and SSL
3.0 permit users to conduct secure communications over the Internet.
This provides the ability to safely exchange information such
as credit card numbers.
| note |
The Secure Socket Layer, or SSL, protocol was developed by Netscape to facilitate secure communications over the Internet. This is accomplished by encryption of the data as well as authentication of the server. The data encryption is done at a low level that is independent of the higher level protocol being used. This allows SSL to be used with all the common Internet protocols such as HTTP, FTP, Telnet, and so on. The encryption key is agreed upon by client and server and is unique for communications between the two. The server is always authenticated before each transaction takes place. Optionally, the client can also be authenticated. The latest version, SSL 3.0, was published in March of 1996. The following URL provides more details about SSL: http://home.netscape.com/newsref/std/SSL.htm |
Microsoft Internet Explorer offers a new security feature called Authenticode, which verifies that ActiveX controls are from a legitimate source. This security level is especially important if ActiveX controls have access to all of the client's resources, including the file system. While this measure does not protect against poorly written or mischievous code, it does provide a level of accountability to the developer of the software. See Chapter 23, "Security with ActiveX Authenticode," for a detailed discussion of Authenticode.
The features of Netscape Navigator 3.0 and Microsoft Internet
Explorer 3.0 are very similar. Instead of comparing all the features,
this section focuses on the major differences. Table 25.1 summarizes
the major differences between the two browsers.
| Feature | Internet Explorer | Navigator |
| Scripting support | VBScript, JavaScript | JavaScript only |
| ActiveX | Yes | Plug-in only1 |
| ActiveX documents | Yes | Plug-in only1 |
| LiveConnect | N/A | Yes |
| ActiveX code signing | Yes | Plug-in only1 |
| Multicolumn tag | No | Yes |
| Style sheets | Yes | No |
| Video playback formats | AVI, MPEG, MOV,QuickTime | AVI only2 |
| Audio playback formats | AIFF, AU, MIDI, MPEG audio, WAV | AIFF, AU, MIDI,WAV2 |
| 1Note that ActiveX support in Netscape Navigator is limited to HTML documents that use the <EMBED> tag to place the control. Microsoft and all of its development tools use the
<OBJECT> tag.
2Other audio and video formats may be available through plug-ins. | ||
This chapter explains the key functions of the newest Web browsers. As a developer of Web applications, you need to understand the capabilities of browsers because they contain and present your applications to the user.
The first step in developing a Web application is to define your audience. Will the entire population of Web users be using your application, or will it be used only inside your company? Will all the users of your application have the same operating system, or will people be using a variety of different system platforms (for example, Macintosh, UNIX, Windows 95)?
The next step is to identify the technologies that you will be using in your application. Will you be using ActiveX? What multimedia capabilities do you intend to use? RealAudio? VRML? Shockwave? Your answers might depend on the browsers available to your audience. Alternatively, you might decide on the technologies first and then choose the appropriate Web browser.
For example, if you are developing a database application for an intranet, you might have full control over the browser that your audience will be using. In this case, you can use what-ever browser best supports the technologies that you require. At the other extreme, you might need to support the entire population of Web users. In this case, you will need to limit the technologies that you use to the most widely deployed features. Because you are reading this book (and therefore probably working in Java), you most likely do not expect to support every browser out there, since not all browsers support Java.
Understanding the audience and the browsers that the users will be using is extremely important to the developer. This information must be a top consideration when you design a Web application.
The purpose of this chapter is to explain the key features of Web browsers. In particular, the discussion centers on the market leaders, Netscape Navigator and Microsoft Internet Explorer. These two products together own more than 90 percent of the browser market.
The next few chapters cover some of the features of today's Web browsers in more detail, beginning with a discussion and tutorial of HTML. Subsequent chapters discuss the scripting languages JavaScript and VBScript.