Part 8: Programming the Web
Netscape Navigator 2.0 or later and Microsoft Internet Explorer 3.0 or later support both Java and JavaScript. Although Java is sometimes used to display graphics, it is not limited to graphics-related functions. It is a programming language, and as such, can be used to write virtually any kind of program.
JavaScript is a much simpler and more limited language than Java. JavaScripts are typically pasted directly into your HTML, although they needn’t be. JavaScript is usually used to alter a browser’s screen display in some way, such as putting info onto the screen or into a dialog box, or perform some other simple function, such as change the screen color, etc.
Here is a simple JavaScript that returns the user to whatever page they came from, when a button named “backarrow.gif” is clicked.
Here’s a longer JavaScript example that displays a scrolling message across the bottom of a web page in any JavaScript-capable browser. There have, in fact, been a number of interesting variants of the ubiquitous scrolling message at the bottom of a page. The original one actually had what amounts to a bug that could cause your browser to run out of memory. Paste this one after the tag as shown.
As mentioned above, both Navigator and MSIE (3.0 or later) support Java and JavaScript. MSIE also supports ActiveX, which is Microsoft’s own method of adding interactivity to Web pages. While it is possible to add ActiveX functionality to Netscape via a plug-in from Ncompass Labs (http://www.ncompasslabs.com), Java is more widely supported and you should probably use that if you are able to.
The Java language is built into Netscape 2.0 or later, and Java is supported by most of the industry heavies, including Microsoft and IBM. It provides Web users - or at least programmers who can deal with the C++-like idiosyncrasies of the Java language - with the ability to make a Web page perform almost any kind of function. Because Java tends to be very complex, a number of programs (and books) exist that make it easy to add “pre-packaged” Java objects to your Web pages. One example is Egor.
Egor, by Sausage Software (distributed in North America by Anawave Software) is an easy-to-use program for creating and Java applets with animation and sound. Using Java is a good choice for such animations, in that current versions of Internet Explorer and Netscape Navigator both support Java without requiring additional plug-ins or other configuration.
On the other hand, Java-based text and animations can be a little slow to download, due to the overhead of the required Java applet, which is automatically downloaded and initialized when an HTML page with Java is loaded.
In the big scheme of things, Java-equipped pages are more convenient and functional to the user and load faster in most cases than ShockWave pages, but are likely to be slower to load a simple animation effects than a page with animated GIFs.
Egor, like many utilities is available online in a demo/evaluation version. The limitation of the online demo version is that it cannot be used to create web-hosted animations; it only works with the files on your local hard disk until you upgrade to the full commercial release version.
In case you haven’t tried it, it’s worth mentioning that you can’t just save a web page containing a Java applet and expect it to work in your own page. Even if you download the “classes” required for the page, it still won’t work. Your best bet is to go one or more of the sites with free working examples and see for yourself what you need to download.
Want to add Java support to your web pages? You’ll find many sites on the Web with freely reusable Java applets and instructions to get you started. Start at Netscape’s Creating Net Sites page (http://home.netscape.com/assist/net_sites/index.html) or do a search with your favorite search engine.
There are a number of things you can add to your web pages that give the a certain amount of intelligence. For example, check the page at http://acwww.bloomu.edu/~mpscho/jsarchive/calendar.html to see a page that greets you with a “Good Afternoon,” “Good Evening,” or other appropriate time-of-day salutation.
In fact, there are a number of excellent JavaScript resources on the net. A good place to start is http://acwww.bloomu.edu/~mpscho/jsarchive/
This site contains a number of well-documented, free-to-use JavaScript code snippets. Because there is no point in printing the entire code out here, I will refer you to the description of what each one does.
While it is beyond the scope of this course to fully explore the possibilities of the Common Gateway Interface and exactly how to code common “ciggie-bin” functions like server-push animations, access counters, and so on, it’s worth mentioning that the trend is clearly toward functions like those provided by Microsoft’s FrontPage server, where the complexities of CGI-bin programming are largely hidden from the web-page author. He or she simply invokes a menu command from the authoring environment that drops in a section of code that enables one of several CGI-bin functions.
Front Page, for example, provides “bots” for automating the creation of interactive discussion groups, reply forms, guest books, user surveys and more. As Java and ActiveX components become more common and sophisticated, I expect to see a boom in the market for drop-in “intelligence” that adds these and other functions easily and quickly.
There are a number of CGI-bin scripts on the Web for your perusal, and some products, such as HoT MetaL Pro 3.0 and Luckman’s Web Commander, contain numerous CGI-bin examples.
ActiveX is the Microsoft technology formerly known as “OLE Custom Controls.” It is currently supported by MSIE for Windows 9x and NT/2000 only, but is not necessarily platform dependent.
What can it do? Most importantly, it can install new capabilities into the browser without intervention (it defaults to asking you first).
What can it do? Just about anything. Like Java, ActiveX provides all the power of a full-blown programming language.
Softoholic ActiveX controls WWW server http://enet.ca/Softoholic/ocxserver/
Other interesting tools and resources are also available on the Microsoft Internet Developers home page at www.microsoft.com/workshop
Accessing ActiveX functionality from a Netscape page is possible, too.
Ncompass Labs, a spinoff from Simon Fraser University's Excite Lab, adds ActiveX compatibility to Netscape’s browser -- in essence, making the whole Microsoft vs. Netscape development point moot. Of course, the MS browser’s 3.0 release or newer also supports Netscape plug-ins, so one needn’t choose sides.
I've tested this with the following plug-ins:
Windows
Incidentally, if you have noticed that Netscape plug-ins aren’t working, try viewing the pages with Netscape, then retry IE (version 3 or newer). Due to some incompatibility issues in syntax between Netscape Navigator and Internet Explorer you sometimes still need to view the demos with Netscape first just to ensure that the files have been downloaded and configured properly on your system.
The Ncompass demo pages at http://www.ncompasslabs.com/activex/ and the RealVR Traveller plug-in (www.rlspace.com) fall into this category.
Sooner or later, you are probably going to want to remove one or more ActiveX components from your system. How do you do it?
Once you've made your Web pages, graphics, VRML files, Java applets and/or whatever other content you have created, you have to put it up on the Internet for others to access...or do you? Many people don't realize that HTML files can also be accessed from a hard disk, CD-ROM, or over a local area network. More than a few people have realized that the plentiful array of authoring tools for Web pages can also be used to create multimedia presentations and electronic documents for convenient cross-platform distribution.
But, assuming that you want to make your Web pages available to users around the world, here's how to do it:
You'll need to find out how much your Internet Service Provider (ISP) charges for hard-disk space on their server. Some ISPs provide a megabyte or so of disk space as part of your account; most charge extra for Web pages intended for business use. Assuming that the price is acceptable, all you need is your account name and password to gain access to your allocated portion of the ISP's hard disk(s); you can then upload your Web pages, graphics and whatnot to the site.
To upload the files, most people use an FTP (file transfer protocol) program. On the Mac, I use a program called Fetch; under Windows, I prefer WS_FTP (there are many others available, too). OS/2 Warp comes with a good FTP program; they all work similarly. Because of Windows 3.1's eight-dot-three filename limitations, we recommend a 32-bit operating system with long filename capabilities; a good 32-bit FTP program can handle long filenames without any manual fiddling on your part. You see your files on one side, and the remote directory (i.e., your ISP's site) on the other. You can "get" or "put" files with ease - as long as you have the password to the site. This way, other people can't delete or change the files at your site without your permission.
Once posted to the site, users around the world can access your pages simply by specifying their URL (uniform resource locator) address. If you don't like your site address looking like a subdirectory on your Internet provider's drive (e.g., http://www.yourprovidername.com/yourdirectory/yourhomepage.html), you can pay to register your own domain name with an organization called InterNIC. Prices vary; ask your ISP if they can do the namesearch and handle the registration for you.
For example, I registered The Computer Paper's Web site URL as tcp.ca (I like short addresses, but the server was also set up to recognize the name "www.tcp.ca", as many people expect the "www" prefix). Naturally, once you've registered the URL, no one else can have a site with the same name.
Note also that recent versions of Netscape, Internet Explorer and some other Web browsers don't need the ungainly and hard to say "http://" code that is commonly quoted as the first part of a Web address.
...or “How do you create a BINHEX file, and why would you need to?”
If you want to make programs or data files other than web pages available on the Web, you should compress the files. While virtually all of us have downloaded files aplenty, not everyone is familiar with how to actually create some of the formats listed below. So, in this section, we’ll look at the various procedures.
The following archive types are just a few of the many common formats on the Net, but should be sufficient to handle any of the data types you’ll need to make available on a Web or FTP site.
Once you have created a ZIP archive, you need only to upload it to your ISP’s site (or your own Web or FTP server) and link to it from your Web page. As for all the archives mentioned here, it is polite to warn users in advance how big the files are they will be downloading. Consider also giving them an idea how long a download will take under optimal conditions at a common speed, such as 28.8 Kbps.
Many network and Usenet gateways only support non-binary files. If you will be e-mailing Macintosh data files, BinHexing or Uuencoding the data is required.
Have you ever experimented with a TRACERT command? Windows 95 and Windows NT both have TRACRT facilities built in, so I'll describe the procedure using them as an example. First, let's ask the obvious: what is TRACERT? It is a utility that lets you watch the route your TCP/IP data is traveling. For example, if your Internet connection seems slow (and whose doesn't?), TRACERT will let you see where the bottleneck is. For example, I thought our local Internet service provider was the main reason for our sluggish web performance, but TRACERT demonstrated that this was definitely NOT the problem. In my tests, MCI's gateway in Seattle is the bottleneck, nearly 3000% slower than our local ISP's link.
Here's how TRACERT works:
It's probably obvious, but smaller millisecond values are better.
See also: Visual Route, NeoTrace.
Useful Windows commands: Ping, Ipconfig, Winipcfg.
Setting up an interactive web site can be simple or complicated, depending on your choice of tools.
For these examples, I used two Windows-based tools: Microsoft FrontPage 1.1 and Luckman Interactive’s Web Commander. I also tested some Mac-based Web servers, including MacHTTP and Webstar, but found them to be less advanced than the Windows-based offerings.
Luckman’s offering, for example, not only handles Perl scripting and Java support, but also includes support for transaction processing. The NT release has a few additional capabilities not found in the 95 version, such as support for multiple simultaneous IP addresses and the Excite search engine.
From the moment I saw the company’s ad for the product, I had the feeling that Luckman’s Web Commander might be a hot product. The brochures and packaging had a high-quality look, and once I’d examined the manual (a hefty inch-thick tome chock full of code examples and how-to tutorials), this sense was even stronger. Windows 9x and NT versions of Web Commander are available; I tested the lower-priced Win9x version, thinking that a greater number of would-be web authors would be able to manage that operating system’s easier network configuration and management facilities. Certainly, I fall into that category.
Running Win9x, I was able to set up Web Commander and access it via the Internet in less than five minutes, with no unexpected surprises, other than noting a number of dialog boxes with very dubious spellings (a plight that plagues the manual as well).
The manual author’s lack of a spelling checker notwithstanding, I am extremely impressed with Web Commander. If you have been looking for a way to set up an intranet, Web server and/or e-mail system, this will do it.
WC can generate statistics about how many “hits” your site (or, indeed, a specific page) has had, and it can perform nifty tricks like automatically generating custom HTML pages with its scripting capability and connecting (via ODBC) to a number of standard database types, allowing “database-driven” webs, such as you might want to have in a transaction-processing environment. It can also create and drive server-side or client-side image maps and comes with a utility to create them.
In fact, transaction processing is probably the most important feature of Web Commander. It supports the RSA encryption standard and thus qualifies as a truly “secure” web site, and it can process credit card transactions either manually or automatically (example CGI-bin scripts are included), using any one of a number of credit-card clearing houses. The system defaults to using the NaBANCO system popular in the U.S.
With Web Commander, you can set up an order form, define a range of products, and process the transactions right over the Internet. Because the system uses the RSA security standard, the customer’s credit card information is not transmitted in a readable form over the Net. While no system is probably 100% foolproof, RSA (also supported by Netscape and several other industry leaders) is one of the best known.
The WebCharge function in Web Commander allows web publishers to conduct complete commerce over the Internet. The publisher can either contact their bank and use the clearing house they use or set up a merchant account directly with either - NaBANCO, MDI (Modular Data Inc.), any clearing house using Visa 2 Protocol, or TDSI (Transante Data Services Inc.) (these are the top four clearing houses) with which Web Commander is supported. When an end user purchases an item from the Web site, they submit their credit card number and expiry date.
The credit card information is forwarded to the clearing house for verification and authorization. The clearing house will either send an authorization number back or decline the card. When the transaction comes back with and authorization number the transaction is stored in a database. At the end of the day all transactions are sent to the clearing house to be processed. The clearing house will bill the end user's credit card and credit the publishers merchant account (sales) and bill the publisher and credit the user (refunds).
According to Luckman, the WebCharge is totally secured if used with Web Commander. When the end user submits their card number and expiry date to a site using Web Commander (configured for HTTPS or SHTTP) he can be confident that no one on the Internet can steal their personal card number. Once Web Commander has the card number, WebCharge instantly talks to the clearing house through a private line. Private lines are very secure and not shared by anyone.
The credit card is transferred from Web Commander to WebCharge by using the WebCharge API. The CGI program calls a single routine provided by the WebCharge DLL to process the transaction (users manual will give examples of how to write this).
Other Capabilities
WebPage Wizard
Although not the most advanced HTML authoring tool available, WebPage Wizard is definitely one of the easiest. Using the step-by-step Wizard metaphor that has become common in many of Microsoft’s recent offerings, WebPage Wizard walks you through the process of creating a variety of web page types, including forms, discussion boards, corporate web sites, and so on.
WebStudio
Actually a renamed version of InContext Spider (reviewed in TCP’s Oct. ’95 and Nov. ’95 issues). WebStudio is a quirky but powerful HTML editor, with a user interface best described as enigmatic, using confusing icons and a difficult to understand layout -- in other words, not one of this package’s strong points. In our tests, WebStudio crashed when Internet Explorer 2.0 (included, along with Enhanced Mosaic on the WC CD-ROM) was set as the default web browser, although WC’s readme file described a workaround.
Search
Excite only runs on Windows NT (and, in fact, is the search engine we use here at TCP’s web site), but the Win95 release includes WAISlook, another search tool.
POP3 Mail Server
POP, or Post Office Protocol, is the term that refers to incoming mail. WC includes full e-mail capabilities, although the POP server had to be set up manually after the WC installation was complete.
DNS Server
A Domain Name Server is an important part of any Web server suite. DNS services allow users to access sites based on domain names (e.g., www.someplace.com) rather than hard-to-remember IP address numbers (e.g., 204.191.160.1). Web Commander includes a DNS server.
What it is not
WC is not an FTP server (this is a different protocol).
For further info:
Contact Luckman Interactive at supp...@luckman.com
or call at (213) 614-1758
Luckman Interactive Web site is at http://www.luckman.com
Mailing lists are a powerful feature of SLmail. They allow you to send mail to many correspondents with a single command. They may be used internally – for example, to send mail to the whole sales department – or externally – for example, to send mail to all registered users of one of your products.
Slmail can also function as an autoresponder.
One of the easiest products currently available for building an interactive website is Microsoft FrontPage.
If you are trying to set up your own web site or "intranet," this product is a piece of cake to set up and configure, with its Wizard-driven approach to creating sophisticated interactive pages. Even a novice web author will be able to build a sophisticated web site, including interactive elements such as a Guestbook, Discussion Web or Freeback form with FrontPage in next to no time without writing a line of HTML code, using that program's “bots” feature.
Some of the pre-designed forms and bots included are a discussion group, feedback forms, a simple search engine and a mailing list.
FrontPage can import three types of text files: TXT, HTML and RTF. Unfortunately there is no support for importing Microsoft Word or other word processor files directly. However, an MS Word page converted to RTF will convert to HTML complete with graphics, subheads and other styles intact.
One of the most useful tricks when designing a web page is making use of transparent backgrounds to have your logo float over the background, instead of your logo being in a big white box. FrontPage makes this painfully easy. Just select the "Make transparent" tool from the menu and click on the color on your image that you want to make transparent. If you've imported a JPEG file, which does not support transparent backgrounds, FrontPage will pop up a dialog, asking you if you want to convert it to a GIF. It does the rest.
The standard image files used on the web are GIF and JPEG. FrontPage will automatically convert most files formats to one of the format you choose. The properties dialog for images allow you to specify JPEG compression ratios, GIF interlacing, image size and alignment as well as low source and URL parameters.
Another cool effect that baffles a lot of people is how to make a clickable image map. This is used when you have an image with a number of areas you want to make clickable to they'll link to somewhere else. You used to have to load up the image in some special program, draw your polygons, then figure out how to make the resulting map file work. It was pretty convoluted.
FrontPage has image map editing tools built in. Just create your polygons, specify the URL to link to and you're done. It automatically embeds a client-side image map right into your HTML file.
I recommend that you focus on creating an Internet presence that emphasizes content over hype. People don't want billboards on the information highway, they come for the info. Update your site frequently; it's What's New that will keep Web surfers coming back again and again.
If your skill-set doesn't include expertise in design or grammar, consider having a professional help you put together a Web site that works. We think that having a presence on the World Wide Web will soon be as important as having a fax number or a business card - perhaps more so. Fortunately, at least at the time of this writing, the free HTML and VRML tools you need to get started are as good, or, in many cases, better than the commercial ones.