There's no doubt about it, the World Wide Web is here to stay. And from the way things look, Netscape Navigator will continue to be a major player in the ongoing Web Browser wars. Embracing and developing new Web standards keeps Netscape ahead of the pack. From Java to JavaScript, LiveConnect to the Plug-in API, and HTML to VRML, Netscape sets the pace. According to Netscape's management, this pace is not likely to slacken because they consider themselves a rabbit with a pickup truck bearing down on it. That truck would be Microsoft.
In the first quarter of 1996, Netscape introduced the Plug-in Application Programming Interface (API). This new interface, provided by Netscape Navigator 2.0 and above, allows software vendors to seamlessly embed their products in any given Web page. With the introduction of Navigator 2.0 Beta, a first wave of plug-ins quickly appeared, providing support for new image formats, interactive documents, presentations, animation, Virtual Reality Modeling Language (VRML), audio, video, and utilities. In the second quarter of 1996, Navigator 3.0 brought developers LiveConnect, which provides communication among Java, JavaScript, and plug-ins.
LiveConnect really defines the relationship between plug-ins, JavaScript, and Java. JavaScript, a fully interpreted language, is the slowest but most flexible and easy to learn. Java, using bytecodes, is faster, although it is still interpreted on a binary level. Both JavaScript and Java are totally platform independent. Now contrast that with a plug-in, which is extremely fast because it is object code but is also tied directly to the platform. LiveConnect provides communication for the three Navigator extensions so that each one can be used to its full potential.
Throughout the course of this book, you will learn how to write a plug-in code module for Netscape's Navigator. You will learn about a plug-in's architecture, design, and implementation using HTML, Java, and JavaScript. Plenty of examples are provided, complete with fully functional source code. Part IV of this book gives step by step directions for creating a plug-in from scratch with Microsoft, Borland, and Watcom compilers.
Netscape Navigator plug-ins are dynamically loaded code modules that become part of the browser's code path. That is, after the plug-in is loaded, it becomes a direct part of the browser code. This technique provides the best possible speed, but it lacks in security and platform independence. Visually, a plug-in looks as if it is a seamless part of the Web page in which it is embedded. After users get the appropriate plug-in, they often are not aware that the plug-in is in operation.
Because plug-ins are object code, they must be written in a language that can be fully compiled. Also, in the case of Windows, the development environment must be capable of generating a Dynamic Link Library (DLL), complete with compiled resources. Keeping that in mind, this book is focused toward C++, which is the most popular Graphical User Interface (GUI) development language that fulfills these requirements. Additionally, because the original Netscape Plug-in SDK was written with Microsoft Visual C++ and its associated Microsoft Class Library (MFC), this book has a slant toward MFC.
It makes absolutely no sense to write a plug-in with Java. Navigator plug-ins and Java are totally different technologies. Plug-ins are native machine code and have absolutely no security restrictions, unlike Java. Think of a plug-in as a trusted code module-kind of like a shareware application. A user makes a conscious decision to download the plug-in, which is then automatically loaded by Netscape's Navigator the next time it is initialized. Java applets, on the other hand, are executed automatically, which creates bigger security problems.
Java applets are small binary modules that are downloaded whenever needed by the Web browser. In many cases, the user does not know or care that a Java applet is running. Plug-ins, on the other hand, are much larger code modules usually requiring an installation program. After a plug-in is installed, it need not be downloaded again.
To get the most out of this book, you should be (or want to be) a C++ programmer. That doesn't mean that an avid JavaScript or Java programmer won't find good information in these pages concerning LiveConnect. It also doesn't mean that a programmer using another language won't be able to use the included plug-in API documentation. The C++ programmer will get the most benefit from the sample code and discussion, which is all in C++.
Also, this book is targeted toward Windows 95/NT programmers. All of the sample code is written for Windows 95/NT. Again, this does not exclude Windows 3.1, Macintosh, and UNIX programmers. All platform-specific APIs are well-documented.
You'll find that this book is organized into five parts, described in the following sections.
This section introduces different plug-in types with real-world examples. Multipurpose Internet Mail Extensions (MIME) are explained and Helper Applications are discussed with WinSock, DDE, and OLE interfaces documented. Using a plug-in with HTML is demonstrated using the RealAudio plug-in as an example.
The basics are the plug-in architecture, plug-in design, and a complete reference of all plug-in APIs up to Navigator 3.x. The API reference is complemented with a quick index on this book's inside front cover.
The sample code gives real-world examples of plug-ins, complete with source code. The samples include streaming audio, server CPU monitor, MIDI, video, Java, JavaScript, and a WinSock socket spy utility.
Resources for Windows discuss three Integrated Development Environments (IDEs) that are capable of generating a Navigator plug-in for Windows 95/NT. Full step-by-step instructions are provided for the Borland, Microsoft, and Watcom IDEs.
In the appendixes, you'll find data sheets for Netscape's current product line, a listing of today's available plug-ins, and a glossary of terms.
A CD-ROM is included inside the back cover of this book. This CD-ROM contains all the source code required to compile the plug-in examples that are referenced in the book.