Managing Browser Differences
Working around differences in Navigator's and Explorer's handling of CGI scripts
By Mark Baker
One of the most appealing aspects of the Web is the ability to gather and present information interactively. The Common Gateway Interface (CGI) provides a mechanism by which a Web server can exchange information with practically any back-end program or data source and present it to the user as a Web page. Using HTML forms, a CGI process can gather data from a user and use it to update a database or to customize the information presented to that user.
Unfortunately, programming these rich, interactive applications is complicated by the fact that the two leading browsers, Netscape Navigator and Microsoft Internet Explorer, treat CGI material differently in a number of significant ways. If you develop a CGI application using only one of these browsers for testing and then try to use it with the other, you could be in for some nasty surprises. This article will show you how to create CGI applications that work with both browsers.
What does "Refresh" Mean?
Let's build a simple CGI program that asks users to enter their favorite cartoon characters and keeps a database of the answers. The application will present two different views to the user which we will call ShowForm and ShowResults. ShowForm will present the user with a form in which to enter the name of a favorite character. ShowResults will present the running totals for all entries to date. The Submit button on the form will make a POST request to the ShowResults function of the CGI program, which will add the users' data to the database and return an HTML page showing the totals for each character.<>