Chapter 1

Introduction to Netscape ONE


CONTENTS


First there was the Internet. Then corporations adopted the Internet protocols for internal use and intranets were born. Now many companies are developing what Jim Barksdale (CEO of Netscape) and others are calling the extranet-information resources that are available to both the internal corporate user and selected external users, such as customers, suppliers, and stockholders.

Netscape's Open Networking Environment (ONE) is a collection of tools and technologies that can be used to develop applications on the Internet and on intranets. Netscape ONE is particularly well-suited for use on extranets, where internal high-bandwidth channels and the need for access control meet an Internet environment in which users have a variety of platforms and browsers.

This chapter introduces Netscape ONE, describes its distinctive features, and shows you how to download its various components so that you can begin to develop Netscape ONE applications.

Open Network Environment

Netscape Communications has been an innovator in many Web technologies-Java, JavaScript, and multimedia, to name a few. In 1996, Netscape, responding to market pressures from Microsoft, began licensing their technologies as a suite under the name "Netscape Open Network Environment," or Netscape ONE. This chapter describes the technologies of Netscape ONE and compares Netscape ONE with the Microsoft competitor, ActiveX.

Netscape's Claims

Netscape itself describes Netscape ONE as "a collection of technologies, tools, and standards that Netscape products and products from other companies support." Using Netscape ONE, developers can "quickly and easily create robust, dynamic, cross-platform Inter/Intranet applications." The Netscape ONE application architecture is illustrated in Figure 1.1.

Figure 1.1: A Netscape ONE application is based on a "universal client," Navigator, and an array of client- and server- based technologies for delivering dynamic content.

Let's examine Netscape's claims a bit further.

Decreased Development Time  Netscape claims that applications can be developed with Netscape ONE "quickly and easily." In modern software engineering, half of the development time often is consumed with analysis and design. Another ten percent or more may be taken up by testing. Netscape provides a set of complete applications that solve several major business problems. These applications, known as the Netscape Commerce Products, are described in detail in the section titled "Netscape Commerce Products" in Chapter 18, "Learning More About Netscape ONE Technology."

ON THE WEB
http://home.netscape.com/comprod/products/iapps/index.html Learn about the range of Netscape Commerce Products at the site which begins on this page.

Netscape also provides access to an online repository of starter applications and tools called AppFoundary. If your application doesn't match one of the Commerce Products, you may benefit from using one of those starter applications. By eliminating much of the analysis and design time, and significantly decreasing labor required for the implementation and test activities, you can field Netscape ONE applications far more quickly than you could if you had to start from scratch.

ON THE WEB
http://home.netscape.com/one_stop/intranet_apps/index.html / This site is the home of AppFoundary. Visit here for starter applications, tools, and other Netscape ONE resources. Take note of the list of newsgroups and mailing lists dedicated to Netscape ONE and AppFoundary topics. (You'll get even more information if you're a member of the Netscape DevEdge developer's group.)

Netscape ONE includes JavaScript as one of its core components. Because JavaScript is available on both the server and the client, developers can learn the language once and write code that runs on both platforms. Since JavaScript is a simple language, many JavaScript programs can be written by people who do not consider themselves to be professional programmers. These same people have written sophisticated spreadsheet applications, Hypercard stacks, and, in an earlier generation, BASIC programs.

Improved Error-Handling  Netscape describes Netscape ONE applications as "robust"-a software engineering term used to describe applications that deal well with exceptions and unexpected input. For example, an application may prompt the user for numeric input in a range between 0 and 1,000, but the user may enter a negative number, or a number greater than 1,000. The user may leave the field blank, or try to enter letters instead of numbers. For years, the accepted approach to deal with errors of this sort was to call library routines to read and process the input, then read the status codes returned by each library routine. It is not unusual to see 50 percent or more of the total code be devoted to error checking. Figure 1.2 illustrates this technique with a flowchart.

Figure 1.2: Old-style error-checking requires the programmer to check each step of input processing. This method is labor-intensive and can lead to large, slow applications.

The modern technique is to use exceptions-software events that are "thrown" at low levels and "caught" and processed at higher levels in the code. Figure 1.3 illustrates this model.

Figure 1.3: Modern exception-handling allows the programmer to separate the detection of the error from its processing. This approach leads to solid code with only a modest cost increase.

Netscape ONE includes a set of Java classes, called the Internet Foundation Classes, or IFC, which support exception handling. The Netscape ONE developer can call the Netscape IFC from Java, JavaScript, or a plug-in, and take advantage of the exception-based error handling and recovery mechanism.

Dynamic Applications  There was a time when most Web sites consisted almost entirely of static HTML pages. Some Webmasters added Common Gateway Interface (CGI) scripts, but these scripts required custom programming, which added expense to the site. Typical CGI scripts were therefore used to link the site owner to the site visitor by giving the visitor access to HTML forms. The Perl programming typically used for CGI scripts was beyond the reach of non-programmers.

With the introduction of Netscape's LiveWire and LiveWire Pro development tools, the non-programmer acquired access to a new language: server-side JavaScript. JavaScript is a much simpler language than Java, C++, or even Perl, and many Webmasters found that they could write dynamic applications that delivered custom pages built in direct response to the site visitor's actions.

Other Webmasters began to add client-side JavaScript to their pages or inserted Java applets to liven up the content. On some sites, Webmasters have added custom content such as video and audio, which is presented using platform-specific Navigator plug-ins. Now, with Netscape ONE, Netscape has integrated all of these technologies into an integrated package called LiveConnect. Using LiveConnect, a Webmaster can lay out a page (either a static page or a dynamic one, served by using LiveWire and server-side JavaScript). The page can have user controls provided by client-side JavaScript that control Java objects or, through Java, a Navigator plug-in. Figure 1.4 illustrates such a page.

Figure 1.4: A Web page designer can serve a page dynamically by using LiveWire or LiveWire Pro, and can include dynamic content by using Java, JavaScript and Navigator plug-ins.

Cross-Platform Development  One of Netscape's most significant distinctions is its support for all major platforms: OS/2 Warp, Macintosh, most major versions of UNIX, and all versions of Windows. Netscape's only serious competitor, Microsoft, is betting that users won't want all those platforms. Microsoft's most advanced solutions run exclusively on Windows 95 and Windows NT.

While most of the desktop computers using the Internet do run Windows, a significant percentage do not. Furthermore, many of the Windows machines run an older version of Windows (typically Windows 3.11). Upgrading those machines so that they can run Windows 95 is a slow, expensive process-many companies have opted to stick with the older versions of Windows until the machines themselves become obsolete. For those users, only the cross-platform solutions of Netscape ONE are available.

Why Did Netscape Communications Offer Netscape ONE?

By now, most people know the story of how Netscape Communications got their start. Marc Andreessen, then a student at the University of Illinois, wrote a program that combined the major media of the Internet-text, images, even audio. The finished product, called Mosaic, changed the way the Web was used. Although the Web had existed as a text-based system for academic papers, Mosaic brought multimedia and, with it, marketing, to the Internet.

Andreessen wrote Mosaic for the National Center for Supercomputer Applications (NCSA). Silicon Valley entrepreneur Jim Clark hired Andreessen to write the successor of Mosaic. Six months later the new company shipped Navigator 1.0. The first versions of Navigator were distributed free over the Internet. Even today, you can download both beta and production versions of Netscape's software from their Web site at no charge-their license agreement typically gives you 90 days to evaluate the software before you have to pay for it. The license agreement says that you can use the product without charge if "you are a student, faculty member or staff member of an educational institution (K-12, junior college, college or library), a staff member of a religious organization, or an employee of an organization which meets Netscape's criteria for a charitable non-profit organization."

Microsoft's Come-From-Behind Entry into the Net Market  During most of its first year of operation, Netscape had no serious competition, but by August 1996, Microsoft had released version 3.0 of its Internet Explorer Web browser.

Microsoft, of course, is backed by $70,000,000,000 in assets, almost 20,000 workers, and two decades of software development and marketing experience. Netscape's greatest strength is its depth of experience in this fledgling industry. Netscape also knows that, as fast as the Internet is growing, the intranet market is growing even faster. (Intranets are internal networks, often operated by large companies, which use much of the technology of the Internet.) To capitalize on this strength, Netscape has packaged its server and browser technologies and related tools into an integrated solution: Netscape Open Network Environment, or Netscape ONE.

Network-Centric Computing as a Business Solution  While the threat of Microsoft is very real, Netscape ONE is more than just a reaction to Microsoft's moves. Netscape ONE addresses some important business needs that can now be solved by emerging network technologies.

For years, Sun Microsystems has been reminding us that "the network is the computer." Netscape Communications has turned this slogan into a solid programmer interface backed up with software and open standards. By providing powerful, off-the-shelf network components, Netscape makes it far less expensive for an organization to implement client-server solutions, the foundation of network-centric applications.

Network-centric computing goes beyond simple client-server architecture, however. In traditional client-server applications, the end user runs a client program, names a specific server, and accesses the server through the client (see Figure 1.5).

Figure 1.5: Client-server applications typically have a fixed client and a single, known server.

In a network-centric application, the user requests the application and the client portion of the application downloads from a server to the user's machine. Once on the client machine, the client makes requests back to the network, often invoking the services of one or more servers. The end user does not need to know which server is providing the service or how the application is partitioned between the client and the server. Figure 1.6 illustrates a typical network-centered application.

Figure 1.6: Network-centric applications typically download the client portion of the application to the user's machine, and provide the service from one or more servers.

One of the most important differences between the Netscape solution and the Microsoft approach is the role of the operating system. Not surprisingly, considering Microsoft's success with operating systems, Microsoft views Windows (and particularly Windows 95) as central to network applications. Netscape views the operating system as "just another component." You can build a Netscape ONE solution once and, with few changes, have it run on every platform supported by Netscape. An enterprise with a mix of Windows 3.11 and Windows 95 machines in its business offices, Macintoshes in its publications and marketing departments, and UNIX workstations in its engineering and R&D, can field an application that runs across that whole range of machines. If one of the company's applications will be accessed from the Internet, they can place the application outside the corporate firewall and allow access by their customers and suppliers. With Netscape ONE, all of their trading partners can access all of the features of the applications, not just those partners who use Windows 95.

Should I Be Using Netscape ONE?

Chances are, you already are using one or more components of the Netscape ONE technology. If you write HTML, program in Java or JavaScript, or use Navigator plug-ins, you are using a Netscape ONE technology. The big win, of course, is to use several (or even all) of the Netscape ONE technologies in an integrated fashion to build a network-centric application.

ON THE WEB
http://home.netscape.com/one_stop/intranet_apps/index.html This site, AppFoundary OnLine, lists and describes starter applications, tools, and other resources for the Netscape ONE developer.

You should be particularly interested in Netscape ONE if your application has any of the following requirements:

Why Is Netscape Licensing This Technology?

Netscape is licensing Netscape ONE for many of the same reasons that Microsoft validates software before allowing it to be certified "Microsoft Windows Compatible." When an end user sees that an Internet application has been built by a developer who has licensed Netscape ONE, they can be reasonably sure that the application is compatible with today's version of that product. They can also reasonably expect that the application will work with future releases of Netscape's technology, or that the developer will upgrade the application to stay current with Netscape.

How Do I Get Started?

The best place to start using Netscape ONE is online. Netscape ONE is a fast-moving technology; more components are being added and the existing components are being upgraded. Start by reading the white paper that describes the overall product. Then go to the developer's site and download the Software Development Kit (SDK).

ON THE WEB
http://home.netscape.com/comprod/one/white_paper/ To get the full story on Netscape ONE, read Netscape's vision statement and product roadmap, online at this site.

ON THE WEB
http://developer.netscape.com/library/one/index.html/ After you read the white paper, visit this developer's site for information on AppFoundary and the Software Development Kit (SDK).

You don't need to know the details of each component of the SDK in order to get started. For example, if you know that your application won't need to communicate through an Object Request Broker (ORB), you can safely ignore the Internet Inter-ORB Protocol (IIOP).

To get an even faster start, be sure to evaluate the ready-to-run applications in Netscape Commerce Products, which are described in detail in the section titled "Netscape Commerce Products" in Chapter 18, "Learning More About Netscape ONE Technology."

Netscape ONE versus ActiveX

Microsoft is in an awkward position. Its Microsoft Internet Explorer (MSIE) is the leading competitor to Netscape Navigator. Its Internet product line matches Netscape's product for product-niche for niche. If Bill Gates had his way, all Internet users would be running MSIE on Windows 95 and all Web sites would be on Windows NT servers. Netscape is working hard to make sure Mr. Gates does not have his way.

Notwithstanding, Microsoft's operating systems do have the dominant share of the desktop computer market. More often than not, Navigator is running on a Windows machine. The tools and technology Microsoft has made available to help applications programmers are available for programmers of Navigator plug-ins. When the platform is Windows 95 or Windows NT (or, to a lesser extent, Windows 3.11), you can take advantage of Microsoft's advanced technology to add more power to your Netscape ONE application.

ActiveX is part of Microsoft's integrated Web solution, which includes Microsoft's version of JavaScript called JScript, a version of Visual Basic called Visual Basic Script, and a pro-grammer's interface for the Microsoft Internet Information Server called ISAPI (Information Server Application Programming Interface). Microsoft and Netscape compete head-to-head for the Internet and intranet applications marketplaces. Table 1.1 shows how Netscape's and Microsoft's solutions compare.

Table 1.1  Netscape's and Microsoft's Solutions Compared

FeatureNetscape Microsoft
Web BrowserNavigator Internet Explorer
Authoring ToolNavigator Gold Front Page
Web Server Information ServerEnterprise Internet
Client-side programmingJavaScript JScript or VBScript
Server-side programmingNSAPI or server-side JavaScript ISAPI
Native client-side programmingPlug-ins ActiveX controls and documents
Database integrationLiveWire Pro and IIOP ActiveX
Server integrationOrion None yet
Starter apps and toolsAppFoundary None yet
Commercial applicationCommerce Products None yet

"ActiveX" is a general term Microsoft has applied to several of its technologies. ActiveX technology includes ActiveX controls, ActiveX documents, and ActiveX scripting-three different technologies under one marketing name.

Custom Controls with Active X

Part of the promise of object oriented programming is the fact that much of what we do as programmers is not original. If one programmer has written a good component, other programmers may be able to reuse it. One of the best examples of the success of this approach is in OLE controls. (OLE stands for "Object Linking and Embedding.") Until they were subsumed by Active-X controls, OLE Controls (also known as .OCXs) were among the most popular code resources on the Internet.

OLE controls were reusable software components with broad applicability. They were implemented using OLE control classes, including:

Although you can still build OLE controls, the latest version of the technology is Active-X.

ON THE WEB
http://www.microsoft.com/activex/activex-contents1.htm This site describes a set of technologies that extend OLE controls to the Internet.

Microsoft has been developing component solutions with OLE technology since 1991. When the World Wide Web ballooned in 1995, Microsoft was out of position-they were concentrating on a proprietary Microsoft network that would have competed with CompuServe and Prodigy. To their credit, Microsoft bounced back quickly with a Web browser that rivals Navigator, a credible Web server, and a set of tools for authoring sophisticated, high-quality pages.

In 1996, Netscape led a revolution away from purely static HTML pages. Netscape introduced JavaScript, a scripting language for client browsers. Then they introduced server-side JavaScript, a key component of LiveWire. LiveWire itself offers an integrated environment for developing Web applications, which combine static HTML with server-side JavaScript, and even offer access to relational databases (in LiveWire Pro).

As shown in Table 1.1, Microsoft is attempting to meet Netscape product for product. While the jury is still out regarding which company will win the Internet market (or whether there will be any winner), Netscape clearly has only one serious competitor.

One way Microsoft was able to get into position so quickly was by modifying some of its existing technology. Recall that OLE has been around since 1991. One member of the OLE family is the OLE control (often called OCXs after the name of their file extension). OLE controls are reusable components, such as hierarchical listers or file viewers, that can be controlled by a container object. Many Microsoft development environments, including Visual Basic, Visual FoxPro, and Visual C++, allow a programmer, or even a sophisticated end user, to build containers and embed OLE controls.

ActiveX controls are a Web-based solution that are largely based on OLE controls. The easiest way to write OLE controls is to use Microsoft Foundation Classes (MFC). Likewise, ActiveX controls benefit by being written through the use of MFC. The downside is that such ActiveX controls only work if they are installed on a machine with the MFC library. The MFC library is an encapsulation of the Windows 32-bit API (known as Win32), but Microsoft is working on a cross-platform version of the library that works on the Macintosh. Microsoft has also licensed MFC and the Win32 interface to Mainsoft and Bristol Software. Those companies are reportedly working on a version of MFC for UNIX. Note that the MFC library is not installed on all Windows machines-a user must install the MFC library once before any of the MFC-based ActiveX controls will work.

Note
Microsoft has announced its commitment to make ActiveX run on all major platforms. They are working with Metroworks (a leading tool vendor for Macintosh) and Bristol and Mainsoft (leading UNIX developers) to port ActiveX to those platforms.
Some industry observers have speculated that Microsoft might support Java as a language for writing ActiveX controls. Since Java is platform independent, such controls would run on the Mac or a UNIX box. The downside is that programmers write plug-ins precisely because they need to reach native calls to the operating system. Java programmers, by design, are isolated from the OS. The Java Virtual Machine offers only a fraction of the API of Win32 or the Macintosh Toolbox.

ActiveX controls have another advantage over Navigator plug-ins. By using Microsoft's built-in code-signing and licensing capabilities, vendors who write OLE controls often get paid by the people who use their controls. Most Navigator plug-ins are distributed for free. If Microsoft is successful in extending their licensing model to the Internet, they will provide a powerful incentive for software developers to write for the ActiveX market rather than for Navigator.

Another advantage ActiveX offers is that the ActiveX controls are true OLE controls-they can be used with many containers, not just MSIE. You can use an ActiveX control to embed a new MIME media type in Microsoft PowerPoint or Microsoft Word, just as you would in MSIE. Thus, there is a large market for ActiveX controls, even if MSIE never gets the same market share as Navigator.

Critics point out that ActiveX is a proprietary technology and, therefore, is focused on Windows (even if Microsoft is ultimately successful in porting ActiveX to other platforms). Microsoft has countered by pointing out that ActiveX began its life as an industry standard, with input from thousands of developers. Also, Microsoft has announced that they will transition ActiveX to a new industry standards body in the near future.

ON THE WEB
http://www.ncompasslabs.com/binaries/download_plugin.htm To get a quick feel for ActiveX controls while staying in Navigator, download the ActiveX plug-in from NCompass Labs. The Windows plug-in, available at this site, allows Navigator to support ActiveX controls.

Note
Starting with Navigator 4.0 (a component of Netscape Communicator), Netscape directly supports ActiveX application embedding and VisualBasic applications. You can also view and use in-place editing on existing documents from Microsoft Word, Excel, and PowerPoint.

Installing ActiveX Controls

For HTML authors, Navigator plug-ins are almost transparent. The author specifies content to download (in an <EMBED> tag) or link to (for a full-page plug-in) and Navigator takes care of loading the plug-in at the right time. ActiveX controls are more akin to Java applets than Navigator plug-ins-unlike their counterpart, ActiveX documents, controls are not associated with a MIME media type. To put a control on a page, the HTML author uses the <OBJECT> tag, as shown in Listing 1.1.


Listing 1.1  -Using the <OBJECT> Tag to Install an ActiveX Control

<HTML>
<HEAD>
<TITLE>Demo of an ActiveX Installation</TITLE>
<SCRIPT LANGUAGE="VBScript">
Sub HelloWorld_Click(ByVal x)
  Select Case x
    Case 1
      MsgBox "Hello, World!"
    Case 2
      MsgBox "2nd menu item"
  End Select
End Sub
Sub theButton_OnClick
  call HelloWorld.PopUP
End Sub
</SCRIPT>
</HEAD>
<BODY>
<H1>Popup Menu</H1>
<OBJECT id=HelloWorld CODEBASE="http://www.microsoft.com/workshop/iemenu.ocx#Version=4,70,0,1086"
classid="clsid:7823A620-9DD9-11CF-A662-00AA00C066D2">
<param NAME="Menuitem[0]" value="Say 'Hello'">
<param NAME="Menuitem[1]" value="2nd menu item">
</OBJECT>
<FORM>
<INPUT TYPE="button" NAME="theButton" VALUE="Click Here" ALIGH=RIGHT>
</FORM>
</BODY>
</HTML>

Note that the <OBJECT> tag includes an assigned ID, the URL where the control is stored on the Web, and the class ID (CLSID) for the system registry. Note also that, while JavaScript and VBScript benefit by being inserted in the <HEAD> section, the <OBJECT> belongs in the <BODY>.

Also note the CODEBASE attribute, which tells MSIE where to find the control. Before going to the Internet, MSIE first checks its cache-if it finds an up-to-date version of the control already on the hard drive, it skips the download.

If MSIE needs to download the control, it first alerts the user and asks for permission to download. If permission is granted, the control is copied from the Internet to the user's hard drive. Some users are hesitant to accept software downloaded from the Internet, fearing that it may contain a virus. Microsoft supports code signing-when the control is downloaded, the user can check the electronic signature to verify the software vendor and to confirm that the downloaded copy has not been altered since it was signed. Microsoft hopes that these mechanisms will give most users the confidence to accept downloaded controls.

Caution
When you build ActiveX controls, be sure to set the version correctly. MSIE uses this information to decide whether or not to download a new copy.

If you'd like to get a feel for ActiveX controls without having to program your own, download MSIE 3.0 or later. MSIE 3.0 comes with a few simple controls, including Chart, Lavel, New Item, Preloader, and Timer.

ON THE WEB
http://www.microsoft.com/activex/gallery/default.htm The ActiveX Gallery, online at this address, contains detailed descriptions and <OBJECT> and <param> syntax for each of the controls that come with MSIE 3.0.

In developing plug-ins, Netscape strived to support all four of the major platforms: OS/2 Warp, Windows, Macintosh, and UNIX. Even though plug-ins are written in native code, the best plug-ins make few assumptions about the destination machine. (For example, plug-in developers are encouraged to statically link the MFC library to make sure it is available on the client computer.)

In Navigator 3.0, the end user works with Navigator to download the plug-in. Navigator 4.0 supports auto-downloading but only if the plug-in developer, the HTML author, and the end user cooperate.

Netscape's non-plug-in technologies, Java, client-side JavaScript, and server-side JavaScript, are careful not to write permanent files to the client's hard drive. (They do store temporary files in the cache if the end user has enabled caching.) Thus, a page with 4K of client-side JavaScript downloads that script each time the page is requested (unless, of course, the page is already in the cache).

By contrast, ActiveX controls are automatically downloaded and install themselves on the hard drive by default. If a user downloads a page that includes an ActiveX control, the browser first checks to see if that control is already available on the local disk. If it is available, the browser skips the download and immediately invokes the local copy. This technique dramatically decreases the time required to start the interactive page.

Furthermore, by dynamically linking to MFC, the size of the ActiveX control is smaller than a plug-in with a statically linked copy of MFC. By encouraging programmers to assume that MFC is available on the destination machine, Microsoft makes the average size of an ActiveX control smaller than a comparable plug-in.

Tip
When you build an ActiveX control, you can choose whether or not to include runtime licensing. If you include the licensing classes, a copy of the control can be set to have either a developer's license or a runtime license. A developer's license allows you to place the control in a tool or on a Web page. When visitors to your site download your page, they also download a copy of the ActiveX control. The copy only has a runtime license. With a runtime license, the visitor can use the control on their hard disk, but cannot put it in a tool or copy it to their own Web page.

Tip
If you want to be paid by people who use your ActiveX control on their Web site, turn on the licensing feature.

The "Active" in ActiveX

Most Web pages consist of files of HTML tags and attributes. Regardless of when the file is downloaded, or by whom, the file is the same and the resulting Web page looks the same.

Navigator users can embed client-side JavaScript on the page to give it dynamic behavior. They also can download Java applets, or use server-side techniques such as CGI scripts and server-side JavaScript.

Developers who are targeting the MSIE browser can use VBScript in lieu of JavaScript to put client-side interaction on the page. VBScript is the scripting edition of Visual Basic. The language is a slimmed-down version of Visual Basic and is upwardly compatible with that language. VBScript is included with Internet Explorer 3.0.

ActiveX Documents

If you're a long-time MSIE watcher, you may recall Microsoft talking about "document objects." These objects were intended to give MSIE users a way of viewing non-native MIME media types in an MSIE window. (That description exactly matches one of the major uses of Navigator plug-ins.) By the time they got to implementation, these document objects had been renamed. The direct competitor to Navigator plug-ins is now called an "ActiveX document."

OLE allows an object from one application to be embedded in a document from another application. You can build such a compound document by copying a Paint bitmap to a WordPad document. The container (in this case WordPad) is responsible for maintaining and displaying the compound document. If the user clicks the bitmap, the container calls Paint's interface. Paint, the server, puts up its own menus and controls and becomes the active application.

A document-aware browser such as MSIE (called the host) uses OLE interfaces to contain objects from servers.

Note
The real situation is just a bit more complex than that presented here. In OLE, the container handles document-level issues such as pagination. Browsers typically don't know much about pagination or printing issues, so the server must provide that functionality.

ActiveX Scripting

Netscape's LiveConnect technology, described in Chapter 14, "Principles of LiveConnect," allows a JavaScript programmer to integrate Java and plug-ins with JavaScript. Similarly, ActiveX scripting allows the VBScript programmer to communicate with Java applets and with ActiveX controls. Listing 1.2 shows an example of VBScript on a Web page. Note the resemblance to JavaScript. Like JavaScript, this example comments out the actual script. If the browser is not VBScript-aware, it ignores anything in the comments. MSIE recognizes the <SCRIPT LANGUAGE="VBScript"...> tag and reads the script in the comments.


Listing 1.2  -A Small VBScript Example

<HTML>
<HEAD>
<TITLE>VBScript Demo</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub theButton_OnClick
  MsgBox "Hello, World!"
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H1>Demonstration of VBScript</H1>
<FORM>
<INPUT NAME="theButton" TYPE="Button" VALUE="Click Me">
</FORM>
</BODY>
</HTML>

Like Navigator, MSIE also recognizes JavaScript (though Microsoft calls the language JScript). Listing 1.3 shows a JavaScript example that does the same work as the VBScript demo.


Listing 1.3  -A Small JavaScript Example

<HTML>
<HEAD>
<TITLE>JavaScript Demo</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
  function handleClick()
  {
    alert("Hello, World!");
  }
//-->
</SCRIPT>
</HEAD>
<BODY>
<H1>Demonstration of JavaScript</H1>
<FORM>
<INPUT TYPE="Button" VALUE="Click Me" OnClick="handleClick()">
</FORM>
</BODY>
</HTML>

Both JavaScript and VBScript give similar results. If a developer is familiar with Visual Basic, VBScript may be a bit easier to learn, but the good news is that both languages work.

In general, a programmer may write an ActiveX script in any language for which a scripting engine is available (e.g., VBScript, JavaScript, or even Perl) and run the script on any compatible host. MSIE is the most popular client-side ActiveX host. Microsoft's next-generation client-side project is codenamed "Sweeper."

The examples previously given in this section show how ActiveX scripts interact with a simple form. Much of the power of ActiveX scripting, like the power of Netscape's LiveConnect, comes from the ability to integrate control objects and Java applets.

Recall that an HTML author can install an object on a Web page by adding an <OBJECT> tag and a series of <PARAM> tags. The following code fragment adds an ActiveX control called Label to the page. If you've used Visual Basic and OCX controls, you'll recognize <PARAM> as being the property settings of the control, which you might use on a form in Visual Basic.

<OBJECT
     classid="clsid:99B42120-6EC7-11CF-A6C7-00AA00A47DD2"
     id=lblActiveLbl
     width=250
     height=250
     align=left
     hspace=20
     vspace=0
     >
     <PARAM NAME="Angle" VALUE="90">
     <PARAM NAME="Alignment" VALUE="2">
     <PARAM NAME="BackStyle" VALUE="0">
     <PARAM NAME="Caption" VALUE="A Default Caption">
     <PARAM NAME="FontName" VALUE="Arial">
     <PARAM NAME="FontSize" VALUE="20">
     <PARAM NAME="FontBold" VALUE="1">
     <PARAM NAME="FrColor" VALUE="0">
</OBJECT>

Figure 1.7 shows how this label appears on the page.

Figure 1.7: The <PARM> tags define the properties of the associated control object.

Once a control object is loaded onto the page, you can use HTML objects such as forms and buttons to allow the end user to interact with the ActiveX control.

<FORM NAME="LabelControls">
      <INPUT TYPE="TEXT" NAME="txtNewText" SIZE=25>
      <INPUT TYPE="BUTTON" NAME="cmdChangeIt" VALUE="Change Text">
      <INPUT TYPE="BUTTON" NAME="cmdRotate" VALUE="Rotate Label">
</FORM>

Now link the form control to the ActiveX control object with a bit of VBScript, which should be put in the <HEAD> section of the HTML page.

<SCRIPT LANGUAGE="VBScript">
<!--
     Sub cmdChangeIt_onClick
       Dim TheForm
       Set TheForm = Document.LabelControls
       lblActiveLbl.Caption = TheForm.txtNewText.Value
     End Sub
-->
</SCRIPT>

When the user clicks the cmdChangeIt button, the procedure cmdChangeIt_OnClick() is run. This script grabs the form named LabelControls, pulls in the Value of the form's txtNewText field, and assigns that value to lblActiveLbl.Caption.

Taking control of a Java applet is reported to be just as simple. Microsoft has announced that Java applet control will be implemented in a future release of MSIE.

The ActiveX Server Framework

The Internet is gradually moving away from freeware servers such as NCSA and Apache and is moving toward commercial servers such as those from Netscape. Microsoft is pursuing this market aggressively. Just as Netscape offers a Netscape Server Application Programming Interface (NSAPI), Microsoft offers its own Internet Server Application Programming Interface (ISAPI), now known as server-side ActiveX. Netscape offers LiveWire and, with it, server-side JavaScript. Microsoft offers ActiveX server scripting. Server-based ActiveX scripting is being developed as part of Microsoft's Tarantula and Gibraltar projects.

Many servers provide additional functionality by using Common Gateway Interface (CGI) scripts, most often written in Perl. Microsoft's server supports CGI and the Windows platform supports Perl. However, Microsoft servers are more often scripted in a language like VBScript (a subset of Visual Basic). Microsoft maintains, with some reason, that many more people can learn Visual Basic than will ever learn Perl, so their servers can be configured by a broader range of users.

What About OpenDoc?

For better or for worse, all of the world does not use Microsoft products-at least not exclusively. The biggest competitor to OLE and ActiveX is an open technology sponsored by IBM, Apple, and Adobe (among others) called OpenDoc. These organizations formed Component Integrations Laboratories (CI Labs) to advance component technology.

Not only is OpenDoc different, some reviewers consider it better than other component technologies such as OLE. The industry journal InfoWorld awarded OpenDoc the Landmark Technology Award in its January 29, 1996 "Best of 1995" edition. They write, "OpenDoc has become easily the more flexible, powerful, extensible, and forward-looking object model when compared with its closest business competitor, Microsoft Corp.'s OLE."

OpenDoc works seamlessly with OLE: OLE objects can be served from OpenDoc servers and OpenDoc containers can retrieve objects from OLE servers.

ON THE WEB
http://web.xplain.com/mactech.com/Articles/Vol.10/10.08/OpenDoc-vs-OLE/
text.html
Get a comparison between OLE and OpenDoc from this online article. You can find similar material in an Adobe PDF document on Apple's FTP site, at ftp://opendoc.apple.com/opendoc/docs/ODinfo/OD-OLE.pdf.

ON THE WEB
http://www.opendoc.apple.com/users/getod.html This site is the starting point for downloading Apple's Macintosh implementation of OpenDoc.

CI Labs is working with UNIX vendors to develop implementation of OpenDoc on UNIX. (IBM is already shipping an implementation for its UNIX operating system, AIX, and has developed a version for advanced Windows systems.)

ON THE WEB
http://www.software.ibm.com/clubopendoc/tools.html You can get IBM's implementation of OpenDoc for AIX through this site. You can also get the Windows 95 and Windows NT versions from here.

OpenDoc is standard in the latest versions of the Mac OS and has been endorsed by both Netscape and Sun (ensuring compatibility with the plug-in shell and with Java applets). Apple has developed a set of OpenDoc components, collectively known as Cyberdog, to extend Internet capabilities into OpenDoc-compatible applications such as ClarisWorks. This design means that a user working on a ClarisWorks document can seamlessly access the Web, pull down some information, and embed it or link it into the ClarisWorks document.

At least two MacWeek articles (http://www.macweek.com/mw_1026/news_nav4.html and http://www.macweek.com/mw_1027/opinion_otr.html) report that Navigator 4.0 will be built using OpenDoc (making it compatible with OLE as well). If this report proves to be correct, Navigator plug-ins that are based on OpenDoc may be a more natural fit with Netscape ONE and may offer higher functionality than plug-ins based on OLE. At least one reviewer gives OpenDoc higher marks than OLE for the quality of user interface-not a surprise considering the role Apple played in developing OpenDoc.

MacWeek, Apple, and Netscape also reported (http://www.macweek.com/mw_1026/news_nav4.html and http://home.netscape.com/newsref/pr/newsrelease222.html) that Navigator 4.0 for the Mac will be bundled with Cyberdog by Apple. A joint Apple/Netscape press release says, "…To be called Netscape Navigator for Cyberdog, Netscape will develop a custom component developed specifically for the Apple Cyberdog Internet suite. …Apple will distribute Netscape Navigator for Cyberdog with its Mac OS as the default browsing component for Cyberdog. Apple's plans also call for the product to be incorporated with the Mac OS in Apple computers."

Netscape also announced plans to "embrace and integrate" Microsoft technology. Changes in the <OBJECT> tag in Navigator 4.0 allow developers to embed Microsoft Office document types into a Web page. See http://home.netscape.com/comprod/products/communicator/developer/communicate.html and ;http://home.netscape.com/comprod/products/communicator/datasheet.html for more information on Navigator 4.0.

If you develop plug-ins principally for Windows, you can choose between OLE and OpenDoc. If you develop plug-ins for all major platforms, evaluate OpenDoc to see if your cross-platform workload would be less by developing in OpenDoc.

About Open Standards

The open-standards debate concerns more than the standards themselves-it is about the role that the operating system will play in network-centric applications. In a Wall Street Journal article dated November 18, 1996, Microsoft's Senior Vice President, Jim Allchin, who is in charge of operating systems, described Microsoft's vision of open systems: "Intel will probably continue to be the leader, but any company that supports open operating systems (for example, Digital, Motorola) will be considered." Many industry observers believe that if Microsoft's vision of Windows software and Intel hardware comes to dominate the intranet and enterprise markets in the same way they dominate the desktop market, there will be less opportunity for competition. When competition is reduced, both price reduction and technology improvement are jeopardized. To the extent that open systems win, computing power becomes a commodity and hardware and software prices fall.

Of course, in many applications, the cost of development labor is a dominating factor. If the development environment is based on open standards, there is a larger repository of existing solutions from which developers can draw, so the overall development time goes down. Furthermore, development labor itself may approach the level of a commodity, particularly when much of the "programming" can be done in languages such as HTML and JavaScript, which are typically approachable by people who do not consider themselves professional programmers.

If the application is cross-platform, the use of open standards encourages an "author once, run everywhere" design approach. HTML, Java, and JavaScript are inherently cross-platform. While Navigator plug-ins use native code, they can be written in such a way that they can be readily ported from one platform to another. For example, the Microsoft Visual C++ environment allows a developer to compile code that will run on all Windows platforms, as well as the Macintosh, from a single set of source files.

Is There Anybody Not Using Windows?

Windows (including Windows 3.11, Windows for Workgroups, and Windows 95) dominates the client computer market. Macintosh has a substantial share (though estimates vary widely) and UNIX (in all its flavors) is a significant minority player.

Among servers, the three categories of platforms stack up in reverse order. UNIX leads (with Sun Microsystems dominating the market); Macintosh has a significant minority share; Windows 3.11 is not a player in the server market due to technical limitations; Windows NT has a small but growing share, due in part to the availability of Netscape Web servers on the NT platform.

Competing Security Models

ActiveX's security is based on a concept called code signing. Using this feature, an end user can prove that a particular ActiveX control was authored by a particular vendor. Such proof does not guarantee that the control functions correctly, or that it cannot damage the user's data.

By contrast, Netscape has developed a complete security model that includes message authentication and end-to-end validation. Netscape has extended its security model to encompass the Web, News, and electronic mail, as well as their specialized servers.

Netscape introduced secure communications way back in Navigator 1.0 and the Netscape Commerce Server. Netscape security is based on the Secure Sockets Layer (SSL), which is built into every Netscape product. In general, the Netscape ONE developer does not have to take any extra steps to get a secure communications link. If you need special security features (such as integration with a legacy security system), use the security services of the Internet Foundation Classes to build the custom components.

What's in the Netscape ONE SDK?

The Netscape ONE Software Development Kit contains several standalone SDKs, including the Plug-In/LiveConnect SDK, the Java Development Kit, as well as guidelines and documentation for the built-in JavaScript.

Internet Foundation Classes

You can also download the Netscape Internet Foundation Classes (IFC), which give JavaScript, Java, and plug-in developers access to the infrastructure of a network-centric application. Figure 1.8 illustrates a detailed view of the IFC.

Figure 1.8: User Netscape's Internet Foundation Classes as the basis for a network-centric application.

The initial release of the IFC includes classes that support

HTML Reference Documents

Many of the new features that were added to Navigator in version 4.0 focus on HTML and, in particular, on HTML forms. Navigator 4.0 includes support for advanced positioning (including layering), JavaScript style sheets, and "Web fonts," which give the page designer more control over the appearance of the page on the end user's machine. The JavaScript Style Sheets are compatible with the CSS1 standard, but add programmatic control of such attributes as margins and styles.

ON THE WEB
http://home.netscape.com/comprod/products/communicator/developer/
index.html
  This site is the home of Netscape's information on the new multi-product package, Communicator. Communicator includes Navigator 4.0 as well as e-mail and collaboration capabilities.

Even as Netscape continues to support a richer feature set in Navigator, the World Wide Web Consortium and the Internet Engineering Task Force (the open standards groups responsible for HTML) are adding new features to the standard. HTML seems destined to become a platform-independent resource definition language, in much the same way that .rc files in Windows and .rsrc files on the Macintosh describe the buttons, fields, and dialog boxes that are used in applications on those platforms. Chapter 4, "Netscape Enhancements to HTML," describes many of Netscape's extensions to the HTML standard.

Netscape Navigator 4.0

The original Netscape ONE standard was based on Navigator 3.0 but, of course, has since been updated to take advantage of the latest version of Navigator. While the original version of Navigator was simply a Web client, Navigator 4.0 is much more. The section titled "How Navigator 4.0 differs from 'Standard' Browsers" in Chapter 4 describes Navigator's capabilities as a mail client, including its new ability to handle secure mail. That same section shows how to use Navigator as a client for USENET and other Network News Transfer Protocol (NNTP) services. Part IV, "Extending Navigator with Plug-Ins," contains five chapters that show how Navigator can be set up to handle non-native media types, including audio, video, and three-dimensional worlds. Part V, "LiveConnect," contains three chapters that describe how LiveConnect technology integrates plug-ins with Java and JavaScript.

Java

Sun Microsystems (the same folks who tout that "the network is the computer") has led the development of the platform-independent object-oriented language Java. While most HTML writers recognize Java for its use as the language of applets, Java can be used to write complete platform-independent applications. Netscape is building a Java virtual machine into each of its Orion-class SuiteSpot servers, enabling a developer to automate the catalog server, for example, in much the same way the LiveWire programmer today can automate the Web server.

JavaScript

About the time Java started to become interesting, Netscape was developing a client-side technology called LiveScript. In a marketing move to align the new client-side technology with Java, its more complex counterpart, Netscape renamed LiveScript to JavaScript.

JavaScript bears little resemblance to Java. It is easier to program and is reachable by many people who will never have (or need to have) the technical ability to program in Java. One of the most popular applications of JavaScript, the ability to validate fields, has been subsumed by the new field-validation routines in Netscape 4.0. Future use of JavaScript is likely to favor integration with Java and with Navigator plug-ins by using a technology called LiveConnect.

Chapter 5, "Client-Side JavaScript," describes how to use this built-in language in the Navigator client.

LiveConnect/Client Plug-In

Starting with Navigator 3.0, Netscape has supported the integration of JavaScript, Java, and Navigator plug-ins. LiveConnect allows both JavaScript and plug-ins to communicate with a Java peer object. Using Java as the bridge, plug-ins and JavaScript can communicate indirectly.

Part V, "LiveConnect," describes how these three entities cooperate to provide an integrated, dynamic Web page.

Navigator Remote Control

While many applications have the user in direct control of the Navigator client, other applications call for an embedded Web browser. Netscape allows Windows users to call Navigator either through Dynamic Data Exchange (DDE) or Object Linking and Embedding (OLE). Macintosh users can script the browser with AppleScript, sending Apple Events to control Navigator. UNIX users have a similar capability with X Events.

None of these solutions, however, makes it possible to do what many developers really want to do-embed a Navigator window inside their own application. That solution has finally become achievable with the introduction of component technologies such as OLE and OpenDoc, described earlier in this chapter in the section titled, "What About OpenDoc?" For more information about the integration of Cyberdog into Navigator, see Chapter 4, "Netscape Enhancements to HTML."

In the SDK…

Netscape ONE is a collection of technologies that are used by Internet and intranet developers to develop an integrated network-centric application. Many of the technologies are specifically described elsewhere in this book.

You can get the various components of the Software Development Kit, or SDK, online.

ON THE WEB
http://developer.netscape.com/library/one/index.html/  Visit this developer's site for information on AppFoundary and the Software Development Kit (SDK).