Web based School

Chapter 1

Introducing VBScript and the World Wide Web


VBScript. Maybe you've heard it's a tool that lets you build more powerful Web pages. Perhaps you've heard it called the "JavaScript killer" because it's easier to use. You might simply know it as an Internet buzzword. Whatever your motivations, the fact that you're reading this guide indicates that you want to know what VBScript is all about.

You've come to the right place! VBScript is an exciting, powerful tool at the center of the rapid Internet information revolution. In this guide, you will find everything you need to know to get started. Before you start learning about how VBScript works, you should know a little bit about how the Internet phenomenon began and how VBScript fits into the big picture. It's so easy to get lost in a sea of terminology and acronyms. This lesson cuts through the jargon and helps prepare you for the exciting journey ahead of you-understanding and learning how to use VBScript to its fullest. Questions answered in this lesson include the following:

  • What is the Internet, and why is it so popular?
  • What is the World Wide Web, and how does it fit in to the Internet?
  • What are Web browsers, and how are they used?
  • What are the most popular and widely used browsers available today?
  • What are Web pages, and how are they created?
  • What is Microsoft's ActiveX technology, and how does it relate to the Web?
  • How does VBScript fit in when creating a Web page?
  • What are Java and CGI, and where do they fit in?
  • How are Web pages sent over the Internet?

If you are already familiar with these concepts, you might want to skip ahead to Day 2, "The Essence of VBScript," which discusses how VBScript and Hypertext Markup Language (HTML) work together with the Web browser to present a Web page to the user.

The Internet and the World Wide Web

The Internet, which has come to serve over 20 million users worldwide, had relatively humble beginnings. It began as a rather obscure network called ARPANET-a network used by the Department of Defense, its contractors, and defense researchers. The ARPANET proved very useful and powerful, so much so that over time it grew tremendously. Soon, a more general network called the Internet was created with the same philosophy as ARPANET, only with a broader scope. In the late 1980s, the Internet spread across universities around the world and became more and more popular among researchers in the academic community.

As the popularity of the Internet increased, so did its size. Starting in its earlier days, users became increasingly aware of the benefits of specific services such as electronic mail and the ability to transfer files. Over time, the incredible potential of the Internet for sharing and distributing information became apparent as more and more people started using it. The National Science Foundation, which had almost completely funded the Internet in the United States until 1991, lifted its ban of commercial traffic on the Internet in 1991 and dropped most of its funding. This gave the Internet much more widespread exposure and opened the door to many more commercial ventures. Since then, the Internet has grown in incredible proportions. Given the current and potential growth of the Internet, you can't afford not to learn about the Internet, especially if you are a part of corporate America.

Now that corporations and the telecommunication giants are becoming more interested in the Internet, the Internet is maturing at an unprecedented rate. Organizations ranging from product vendors and standards bodies to the National Science Foundation, which helps support the backbone of the Internet that carries all of the information between the Internet and its hosts, are developing standards and security mechanisms that should take the Internet to new heights. Consider, for instance, the capability to receive real-time voice and video so that you can see the person you're talking to or the capability to order a pizza and watch a movie using the Internet. The possibilities are unlimited. Your ability to leverage its benefits for your company or personal use will become increasingly valuable as the Internet is exposed to more and more people across the world.

What is the Internet, really? The Internet, simply put, is like a vast ocean of computers across the world connected together by a network of cables. Figure 1.1 shows a simplified diagram of how the Internet is constructed.

Figure 1.1 : A simplified view of the Internet.

Because all these computers are connected as shown in Figure 1.1, a computer connected to the network can gain access to any of the others, providing a seemingly infinite amount of information to the user. Suppose, for example, that you are a bird lover who lives in Detroit. You want to get information on how to teach your cockatiel to sing. A computer down in Miami has just what you want-a bird lover's consortium, where people all over the world come to share information about birds. Using the Internet, you could connect to that computer as Figure 1.2 shows.

Figure 1.2 : Internet connection to the bird consortium.

In this example, your computer sends information from your computer's modem, through your telephone line, out to a series of cables that provide access to all of the computers on the Internet. The Internet simply has to route the information from your computer to the computer in Miami-the one you want to access. As long as the Internet provides a valid route, you can send and receive information from this specific computer. If you want to exchange information with another computer in addition to the one in Miami, you are free to do so. The Internet provides this capability for you; all you need to know is the address of the computer you want to exchange information with. The Internet does all the rest.

An Internet address is used to identify a computer connected to the Internet. Every address must be unique, since the computer represented by that address is unique to the Internet. Names are registered through the Network Information Center (rs.internic.net) to ensure uniqueness. Internet addresses can be represented in terms of textual domain names, such as www.doubleblaze.com; or in terms of the corresponding address, called an IP address, such as Uniform resource locators, or URLs, incorporate Internet addresses to indicate the network location of a Web page or other network resource.

The details of the illustration could vary because there are so many different possible routes to connect one computer to another on the Internet. If, for example, you are at work or school rather than at home, you might already be at a computer directly attached to the Internet. In that case, connecting with a modem might not be necessary. Furthermore, once you're on the Internet, you can trade information using a variety of approaches ranging from Web browsers or electronic mail to transferring files.

How do people use the Internet? The Internet is used for sending and receiving electronic mail, exchanging files, reading and participating in news groups, and obtaining information in general. In the bird consortium example, you have a variety of options at your disposal once you're connected to the Web site. You can browse a Web page filled with information on cockatiels or participate in a news group discussion of cockatiel mating habits. You might find a reference to a public file containing research on cockatiel schizophrenia and then download the file to your computer. You could even send e-mail to the president of the National Cockatiel Mating Society, given the correct address. Well, you get the point.

The best way to describe the Internet is to list the services it provides. The Internet has a wide variety of services available to the user. Often, a service on the Internet is called a protocol. A protocol is simply a set of rules for communication. Each service has its own special set of rules to accomplish its goals more easily. The following list describes some of the major services:

A protocol is a set of rules for communicating across the Internet. Both parties know and follow the rules for sending and receiving information, making meaningful communication possible.

  • Electronic mail: E-mail is a very simple and direct way to exchange messages targeted for particular users on the Internet.
  • File Transfer Protocol (FTP): This protocol enables users connected to the Internet to exchange files with other users by sending them to and receiving them from Internet sites.
  • Telnet: This protocol enables a user to connect to another computer on the Internet. With the appropriate privileges, this protocol could, for example, allow you to connect to the university's administration computer from the computer in your dorm room and then enter commands that are carried out on the administrative computer (such as changing all your grades to A's).
  • Gopher: This protocol enables Internet users to access topical information from servers that support the Gopher protocol. This protocol, along with Telnet and FTP, is among the older protocols of the Internet. One of the services Gopher provides is the ability for users to search for information on the Internet by providing a list of news group topics. Users can then quickly and easily access the news groups of their choice from this list.
  • Hypertext Transfer Protocol (HTTP): This protocol, the backbone of the World Wide Web, enables users to send and receive information from Internet servers in the form of documents, or pages, written using the Hypertext Markup Language (HTML). The user who receives the document, often called the client, can then use a browser or other form of software that recognizes the HTML language to view the contents of the document. Through a browser, the user can even access some of the other protocols, such as Telnet or FTP. HTTP and the World Wide Web can thereby facilitate access to the important protocols under one easy-to-use interface. If the user wants maximum flexibility in FTP file exchanges, he'd likely use the FTP protocol directly. On the other hand, the user can browse Web pages and easily locate FTP files from within the familiar browser interface if no advanced use is needed. This ease of use in sharing Web page information and working with the Internet protocols has been central to the widespread acceptance and popularity of the World Wide Web.

A browser is a software program used to view HTML documents within the World Wide Web.

The World Wide Web is by far the most talked-about service on the Internet today. As you can see, it is only one of many services available to the user. This goal of this guide is to teach you how to use VBScript to enhance Web pages. Because Web pages are used within the World Wide Web, we will be focusing on this Internet service. If, however, you want your users to have access to these other services from within your Web pages, you should become familiar with the other protocols as well. Suppose, for example, you want to be able to initiate an FTP session so that the user of your Web page can transfer a file; before you can do so, you need to know what FTP does and how to use it. You can learn more about these other Internet services and the Internet in general by reading The Internet Unleashed 1996 by Sams.net Publishing.

The World Wide Web is an information system that brings together data from many of the other Internet services under one set of protocols. The World Wide Web began in March 1989 when a group of high-energy physics researchers wanted a new protocol for distributing information on the Internet. The European Laboratory for Particle Physics, or CERN, actually proposed the standards, and a consortium of organizations, called the W3 Consortium, was created for continuing to develop the standards. The consortium put together a set of protocols for the World Wide Web by creating the Hypertext Markup Language, or HTML. HTML is the underlying standard and means by which information is exchanged in the World Wide Web. In addition, various browser developers, most prominently Netscape and Microsoft, have at times extended HTML with their own additions. Essentially, the World Wide Web consists of HTML documents, or Web pages, which are delivered by Web servers and can be interpreted by Web clients, or browsers. The next section discusses the Web clients that actually interpret these HTML documents for the user.

Browsing the World Wide Web

As was stated in the previous section, users view information within the World Wide Web by using Web browsers. Before you begin designing the Web pages themselves, you need to be acquainted with the tools people use to view them. Users who access the Internet are not limited to a specific type of computer. It's no surprise, then, that a wide variety of computers and operating systems are supported by Web browsers, including Windows for personal computers, Macintosh for Apple's Macintosh computers, X Window for UNIX systems, and more. How does a browser work? The primary goal of a Web browser is to send and receive data from the Web server that provides the Web page. The underlying markup language used to define the content of pages in the World Wide Web is HTML. Therefore, the server sends the Web page in the HTML markup language, and the browser interprets that HTML code, presenting the page to the user. The next section discusses HTML in detail. Right now, take a look at the most commonly used browsers available today.


Mosaic, created by ncSA at the University of Illinois, was the first full-color, graphical browser available for the Internet. Because it was the first of its kind, Mosaic was the first glimpse many users got of the World Wide Web and likely fired the imagination of many a potential Web page designer. Before Netscape was introduced and dominated the market, Mosaic was the most popular browser available. Figure 1.3 shows a Mosaic session in Microsoft Windows.

Figure 1.3 : Mosaic for Microsoft Windows.

Like most browsers today, Mosaic supports all of the popular Internet services, including FTP, Gopher, and Telnet, just to name a few. Mosaic is available for Microsoft Windows, Macintosh, and X Windows, titled WinMosaic, MacMosaic, and XMosaic, respectively. At the time of this printing, you can obtain each version via FTP at ftp://ftp.ncsa.uiuc.edu/Mosaic.

Netscape Navigator

Netscape Navigator, created by Netscape Corporation, is by far the most popular browser available today. One of the primary reasons for its success is that it is considerably faster than Mosaic, the once dominant browser. It also provides additional features that Mosaic does not have. Netscape is available on Windows, Macintosh, and X Windows platforms. Figure 1.4 illustrates the main screen of a Netscape session.

Figure 1.4 : Netscape for Microsoft Windows.

Netscape is one of several browsers currently available that supports the Java language. The most recent version of Netscape contains specific extensions to HTML that provide much more control over the look and feel of a Web page. Many of these extensions were initially only supported by Netscape, although Microsoft's Internet Explorer 3.0 now supports many as well. Programmers who design Web pages using these extensions must remember that they will not operate with browsers that do not support them. At the time of this printing, you could obtain the latest copy of Netscape directly from the Netscape Communications FTP sites. Due to the popularity of this browser, there are almost 20 FTP sites available for downloading the Netscape browser. The addresses are ftp://ftpx.netscape.com/, where x is a number from 2 through 20, depending on the site you wish to access.

Internet Explorer

Internet Explorer is Microsoft's contribution to the Web browser community. The Internet Explorer is based on Microsoft's ActiveX technology and is available for Windows, Windows NT, and Macintosh platforms. As this browser gains acceptance while Microsoft expands its Internet efforts, Internet Explorer might challenge Netscape for domination of the browser market for Windows users. One significant capability of the Internet Explorer is that it supports embedded intrinsic and ActiveX controls within Web pages, which VBScript can interact with. This very important characteristic will be expanded upon in Days 8, "Intrinsic HTML Form Controls," 9, "More Intrinsic HTML Form Controls," 10, "An Introduction to Objects and ActiveX Controls," and 11, "More ActiveX Controls." Figure 1.5 shows Internet Explorer at work.

Figure 1.5 : The Internet Explorer Web browser.

Microsoft's Internet Explorer was the first browser to support VBScript. As a result, Internet Explorer is used for most of the examples in this guide. If you don't already have a copy, you should obtain one. Here are the steps you should follow to do so:

  • First, download and install Microsoft's Internet Explorer 3.0. At the time of this printing, Internet Explorer 3.0 was still in beta and was available at http://www.microsoft.com/ie. Microsoft plans to provide Internet Explorer 3.0 with the Windows 95 Upgrade Pack slated for release in the fall of 1996. Until then, Microsoft's working beta is the only option available, and you must connect to Microsoft's Web site to download it.
  • In order to use ActiveX controls together with VBScript for the examples in this guide, you must have access to the ActiveX controls used. Pages can be constructed to download the required controls from Microsoft's server when needed. To use the examples in this guide with the beta Internet Explorer 3.0 you should initially run the "requirements check" page on the CD-ROM to obtain all the required controls at one time. Microsoft plans to provide a complete suite of ActiveX controls with the Windows 95 Upgrade Pack slated for release in the fall of 1996. Until then, Microsoft's working beta is the only option available, and you must connect to Microsoft's Web site to download it and the corresponding controls.

Be sure you have Internet Explorer Version 3.0. Earlier versions of Internet Explorer do not support VBScript.

Make sure you have the latest version of ActiveX controls on your system when using VBScript. Earlier versions of the ActiveX Controls may not work properly with the latest version of the Internet Explorer and VBScript.

The Internet Explorer capabilities are expected to eventually become an integrated part of future Microsoft Windows operating environments, and the underlying Internet services it requires will be built directly into the operating system. This means that in the future every user of Microsoft Windows will have easy access to these browser features and the corresponding VBScript support. This is one of the reasons that the Internet Explorer browser is viewed as a very strategic development platform when targeting Web page development, even though it currently has a significantly smaller share of the market than the Netscape browser.

Other Browsers

A variety of additional browsers are available, and because the Internet is evolving so rapidly, other new browsers may have come into existence since this guide was printed. The core language capabilities of VBScript should be consistent under any browser that supports it because the definition of the language doesn't change and isn't dependent on the browser. However, VBScript can take advantage of the browser environment objects as well, and this may vary from browser to browser. The only requirement is that the browser supports VBScript. For any browser developer or provider who makes the request, Microsoft will provide a free license to the VBScript run-time interpreter and even the source code so that they can make their browsers recognize and cooperate with VBScript. If you want more information on these efforts, refer to the VBScript white paper located on Microsoft's VBScript Web site, http://www.microsoft.com/vbscript. You can also refer to The World Wide Web Unleashed 1996 (Sams.net Publishing) to learn more about other popular Internet browsers.

The Elements of the World Wide Web

The overall concept of the World Wide Web is an easy one to grasp once it's had some time to sink in. If you're a newcomer to the Web scene, getting the first, clear glimpse of the concepts can be a challenge! You've heard the old saying, "A picture's worth a thousand words." That's especially true when these words are an alphabet soup of protocols, buzzwords, and technologies. If you consider the simple analogy that follows, the concept of the World Wide Web should quickly come into focus. (See Figure 1.6.)

Figure 1.6 : Sending a Web page to a client.

The two docks have a ship sailing from one dock to the other. The dock on the left is referred to as the "server dock" and the one on the right is the "client dock." The owner of the client dock wants to get some cargo from the server dock. The owner of the client dock sends over a ship and tells the captain of the ship to ask the server dock for a specific type of cargo. Once the ship gets over to the server dock, the worker on the server dock that handles such requests-the "Web server"-loads up the cargo that the client wants. The worker on the server dock knows that special unloading and handling will be needed once the cargo arrives at its destination, so he attaches those instructions to the cargo. Then, the ship sails on its way back over to the client.

When the ship arrives back at the client dock, a worker called the "Web browser" unloads the cargo. It turns out that the Web browser can unload cargo, but she doesn't know how to read the special instructions. Fortunately for her, a couple of assistants are on the dock to handle any special instructions that come their way. The Web browser, along with the assistants, JavaScript and VBScript, unloads the cargo and then presents it to the owner of the client dock. The task is complete.

In real life, a similar sequence of events occurs. When you want to see a Web page, for instance, you first load your browser and then specify the name and address of the Web page you want to view, often referred to as a uniform resource locator, or URL. Once you've entered the URL, the browser connects to the server on which that Web page is found and asks the server to send over the Web page. Using the analogy, this is where the owner of the client dock sends a ship to the server dock requesting cargo. In the same way the cargo sits on the dock, a Web page resides on a server. To send a copy of the Web page over to the client, the Web page must travel across the Internet to the client. In the analogy, you can't get the cargo from the server dock to the client dock without two things-a ship to transport the cargo and water for the ship to travel through. Likewise, data can't get from one host to another on the Internet without a transport mechanism and a pathway for that transfer to take place.

A uniform resource locator (URL) is an address that identifies a resource on the Web.

As with any analogy, you can only take things so far. One thing to keep in mind when using this analogy is that, in reality, a Web page is not actually moved from one site to another. A copy of the page is sent from the server to the client. Picture an unlimited supply of stock on the dock where copies are lifted onto the ship whenever requested. The inventory won't get depleted. However, just as a dock can get very busy and arriving ships might have to wait their turn, a busy server can get overloaded and be slow in responding to Web page requests.

Now, take a look at each element of the Internet that works together to get a Web page from a server to a client. It's really not that complicated once you see how all the pieces fit together.

TCP/IP: The Way Data Moves Through the World Wide Web

The water in the ship analogy is representative of the Internet's means for communication, called the Transmission Control Protocol/Internet Protocol, or TCP/IP. TCP/IP takes care of successfully routing the information from one site to another. The beauty of the World Wide Web is that you, the user, are shielded from most of these inner workings. The protocol sets up an address for each site called an IP address. The IP address consists of four 8-bit numbers separated by dots and is sometimes called the dot address. For example, the address of the Internet site that holds information about this guide and any late-breaking updates is An IP address typically identifies a network card to which a connection is made; as a result, each IP address must be unique. TCP/IP also establishes for every server entity on the Internet an IP machine name. The name www.doubleblaze.com, which corresponds to, is one example of an IP machine name. The IP machine name is part of the URL that you enter into your browser when you want to view a Web page. When you type the URL, which includes the machine name, into the browser, the name is resolved by returning an IP address for the browser to connect to. All of this is transparent to the user. All you have to do is enter the URL of the Web page you want to see. Taken together, all the components of TCP/IP work together to get you to where you want to go on the Internet, much like the water in our analogy.

HTTP: The Way Data Is Transported Through the World Wide Web

The ship in the analogy represents the Hypertext Transfer Protocol, or HTTP. You typically enter http as the first part of any URL on the World Wide Web. HTTP is the protocol that enables Web clients and Web servers to communicate over TCP/IP. HTTP consists of a set of rules by which data such as HTML documents, represented by the cargo on the ship, gets transmitted between Web clients and Web servers. The cargo carried by the ship in Figure 1.6 can consist of Web pages, which are HTML documents, as well as other data. It matters little to the ship what type of cargo it is carrying; the job of the ship is simply to get the cargo from one dock to the other without damaging the cargo. Likewise, the goal of HTTP is to work with TCP/IP to get the data from the server to the client free from corruption.

The Hypertext Transfer Protocol (HTTP) is a protocol used to transfer HTML documents across the World Wide Web. HTTP is the native protocol of the Web.

HTML: The Language of the World Wide Web

As mentioned in the previous section, one type of cargo the ship can carry is HTML documents. HTML documents, or Web pages, are the most common type of cargo that HTTP sends through the World Wide Web. It is easy to get HTML confused with HTTP. Keep in mind that HTTP is the set of rules used to transport HTML documents as well as other data. The analogy in Figure 1.6 should help you to keep these concepts straight. We will explore the structure of HTML much more in Day 2, where you will learn how to embed VBScript code into an HTML document. Consider the analogy once again: Once the cargo arrives at the dock, it must be unloaded. This is the job of the attendant standing at the dock-call that person the Web browser. This attendant presents the cargo to the customer. Likewise, the real Web browser takes the HTML code and makes it presentable on-screen to the user. This is how the user is then able to see the Web page. HTML and the information viewed by the user can be extended using ActiveX controls, VBScript, and other languages such as JavaScript.

Extending the World Wide Web with VBScript

In Figure 1.6, the Web page cargo has special unloading instructions attached to it. These special instructions aren't written in a language the Web browser can understand, so she can't handle them directly. Fortunately, the Web browser has a couple of assistants on the dock with her whose job it is to handle these special instructions. When the cargo gets to the dock, the Web browser passes these special instructions to the assistants, who in turn help her handle the cargo.

In the ship analogy, these special instructions attached to the HTML document represent the interpreters for scripting languages such as VBScript and JavaScript. When you design a Web page, you package these special instructions in the form of code inside the HTML document. Then, when the Web page gets to the client, the Web browser has to be able to recognize the special instructions and have those assistants on-hand to process them.

JavaScript behaves similarly to VBScript in that it uses an interpreter to take the special instructions and execute them on the client computer. The scripting tools differ, however, in that JavaScript is somewhat based on C/C++, whereas VBScript is based on Visual Basic. Furthermore, each tool has a different set of features and capabilities. A great number of Internet users who want to develop Web pages and already use Visual Basic will find VBScript extremely easy to use. Even those who have never used Visual Basic will find VBScript easy to learn as compared to the more complex C++-like language of JavaScript.

Microsoft ActiveX and ActiveX Controls

In an effort to facilitate development of Internet Web pages and applications, Microsoft introduced a set of standards, definitions, and beta software components called the ActiveX Development Kit in early 1996. This set of technologies marked a major technology focus affecting many areas of World Wide Web-related client and server technology as well as Windows itself. ActiveX is a framework that includes VBScript, ActiveX documents, ActiveX controls, and other layers and technology specifications as well. Within this new framework, it is easy to make the once static pages on the Web active. A page can essentially become a blend of HTML, embedded JavaScript or VBScript, ActiveX controls, OLE controls, and Java applets that the code language interacts with.

Microsoft's OLE (object linking and embedding) controls had been in use in the Windows world for some time prior to the introduction of the ActiveX terminology. OLE controls provide powerful, component-based capabilities and are easily incorporated into other programs through the OLE communication, control, data storage, and automation protocol. The ActiveX control technology specification is the new generation of OLE controls. While many ActiveX controls are being developed specifically for Internet-related purposes, ActiveX controls are not restricted to the Internet.

The ActiveX Internet client technology first appeared in Microsoft Internet Explorer 3.0. VBScript is a part of this technology, so it can interact with ActiveX controls. By taking advantage of ActiveX controls, you can greatly extend the power of your Web pages. Many ActiveX controls are available from Microsoft, and any other developer can produce his own ActiveX controls. The end result is a wealth of building blocks that you can blend with VBScript into a powerful, active Web page. A significant part of being an effective VBScript programmer, then, is knowing how to leverage these controls.

Extending the World Wide Web with CGI

Thus far, discussion has focused on scripting tools that reside on the client's computer, interpreting special instructions intended to extend the functionality of a Web page. In addition to residing on the client, a certain type of scripting tool can also reside on the server. Although scripting tools on the server serve a different purpose from those on the client, they are often very useful and sometimes necessary for advanced Web pages-for instance, when a user has a Web page that enables her to perform a search for pages that contain a keyword she supplies to the page. The HTML document itself isn't capable of doing a search because it doesn't know what's contained in other Web pages. Assume, however, that the server contains an entire database of Web pages. It would be convenient for the client page to have the server perform the search and report back the results. Doing so requires that the client request such a search from the server. The Common Gateway Interface, or CGI, was created for that purpose. ISAPI, OLE ISAPI, and IDC are somewhat similar technologies that can be used with Microsoft NT Server scripts. For now, we'll limit the focus to CGI, although the communication concepts described largely hold true to the other technologies as well. Refer to the familiar analogy of a ship sailing between two docks. The analogy so far is based on the server sending out information to the client in response to standard requests for cargo. In this case, however, you want the client to request from the server special information that must be custom-made. Once the server creates this cargo, it sends it to the client. The server can either send a standard Web page or special information requested by CGI that the server creates. Figure 1.7 shows the modified analogy.

Figure 1.7 : Sending a CGI script to the server.

The Common Gateway Interface (CGI) is a standard that allows programs to interface with the Web servers. This gives Web users the ability to interact with Web server programs in order to accomplish useful tasks such as database storage and retrieval.

In this case, the Web browser places the request for special cargo on the ship, the ship then transports the request to the Web server, and the Web server unloads the request and passes it on to CGI for special processing. Once CGI gets the request, it determines the application it needs to call and calls it. Sometimes, the application is like a toolbox that enables the Web server to handcraft brand new cargo to send back to the client. The application gets the data and returns it to CGI, which then passes the results over to the Web server. The Web server then takes the results and passes them back to the Web browser.

CGI, like HTTP, is a protocol that is explicitly designed to interact with an HTTP server. Through a CGI request, the client can request that the server start a CGI script or application, pass parameter data to it, and then return the result from the application. CGI scripts can be written for a variety of servers with languages such as Perl, TCI, or the UNIX shell for UNIX-based platforms. On many Windows-based HTTP servers, a CGI extension layer called WinCGI also makes it possible to call Visual Basic programs. ISAPI, OLE ISAPI, and IDC are other high-performance technologies that can be used for NT Server scripting solutions. OLE ISAPI, like WinCGI, makes it easy to build a Visual Basic program that serves as a server-side script. All such scripting tools work very closely with HTTP servers. Once the server application has done the required work and obtained results, those results can be passed back to the client as HTML text. The server must therefore be able to exchange information with both the client and the application on the server using the CGI protocol.

CGI makes it possible for Web page users to ask the server to perform operations not available to the client. In order to maintain security, VBScript can only perform operations within the Web page; it cannot, for example, store data on the client, nor can it directly store data back on the server to a remote database. Typically, a Web page will rely on CGI services to get data back to the server. On the server's end, CGI capabilities complement the processing of VBScripts on the client's end. For example, a VBScript might process and validate user input, and then CGI might be used to store that data in the host database on the server.

As you can see, CGI and similar technologies offer a very powerful capability to make pages interact with the server. As you learn to use VBScript, you will begin to see the potential for such technologies as they work together with VBScript to enhance a Web page. With the combined power of VBScript and CGI or ISAPI, the programmatic possibilities behind a Web page are virtually unlimited!

The term script is commonly used in several contexts when talking about Web pages. VBScript can be used to build "intelligent" Web pages that carry out processing on the user's computer when the user views a page. JavaScript offers similar capabilities. These are called Web page scripts.
You can also have server-side scripts that carry out action on the server where the Web page files reside. These server-side scripts can be triggered into action by actions on the user's computer when viewing a page, if a page is set up accordingly. Regular Visual Basic (that is, Visual Basic 4.0), among other languages, can be used to write such server-side scripts. It can be expected that eventually VBScript will also be supported on the server and can be used to provide server-side scripting.
The focus of this guide is on Web page scripts written in VBScript for the Internet Explorer browser environment. However, the information presented here about VBScript will be of use in dealing with scripts in other environments as well.


The Internet is an exciting forum that makes it possible for users to access virtually an infinite supply of information. This lesson presents you with an overview of the Internet and, specifically, the World Wide Web. Reading it, you first learned a bit about what the Internet is and why it's so popular. Then, you learned about the variety of services the Internet has to offer-in particular, the World Wide Web. This lesson discusses the World Wide Web, pointing out how the World Wide Web fits into the Internet. Furthermore, the lesson gives you a brief but comprehensive overview of the major browsers on the market today. The lesson then shows you, with the help of an analogy, all of the pieces of the World Wide Web and how they all fit together to get information from one place to another. Specifically, the lesson discusses how ActiveX and VBScript fit into the scheme of the Internet and, particularly, the World Wide Web. In the days that follow, we will discuss VBScript itself, showing you how to embed script into HTML code and extend the power and capabilities of Web pages.


Does any browser that supports HTML also support VBScript?
Not necessarily, although some day almost all of the popular browsers should. Since VBScript is a new technology, it may take some time before all browsers support it. As VBScript becomes more popular, browser developers will want to respond to the demands of Web page designers and Web users, and VBScript will become widely supported!
Does VBScript replace HTML?
Absolutely not. HTML is the foundation upon which Web pages are built. VBScript complements an already existing Web page by making it more powerful and extending its capabilities. You will get first-hand experience at seeing how VBScript enhances Web pages as you continue reading this guide.
Why can't VBScript access files on the client system?
The ability of VBScript to directly access files on the client computer presents a huge security risk. A Web page could, for example, use VBScript to delete or modify files on a client computer-a chance nobody would likely want to take. Furthermore, VBScript is intended to work with the ActiveX controls that live inside a Web page. VBScript is not intended to venture beyond the Web page except through these controls. CGI can be used for that type of interaction on the server, and CGI has much better mechanisms for security.


If you haven't already done so, install and become familiar with as many browsers as you can. Pay particular attention to the Microsoft Internet Explorer, since this browser will be used for most of the examples in this guide. The more familiar you are with the browsers available for the Internet, the more you will appreciate what the World Wide Web provides you and what you can do with VBScript.


Refer to Appendix C, "Answers to Quiz Questions," for the answers to these questions.

  1. What are the most popular services available on the Internet?
  2. What is the name of the language on which Web pages are built?
  3. Is VBScript a part of this language? If not, how does VBScript run?