CGI & JAVAScripts - An Introduction

cgijavaMaking your web-pages more interactive and functional is important and can be accomplished through the use of scripts. The two we will be introducing in this post are CGI and JAVAScripts. You do not need to know how to write scripts – you just need to understand what they are, where they reside (in relation to HTML and website directories) and what actions they perform.  Our purpose today is to briefly explain their functions to make you familiar with them in a very basic context.

CGI (Common Gateway Interface)

CGI is a script (small program) that exchanges data or information collected from the visitor and sends the result to the designated recipient.  This exchange takes place between the server and the browser.   The data that is collected and sent back to the web server is  processed based on the standards of the CGI script that has been uploaded for that specific exchange.   You can have multiple forms using the same script, or you may have different forms using different scripts. 

For example: You have a form people can fill in and ‘submit’. This form allows them to list items for sale on your website. In this case, the CGI script takes the data supplied in the HTML form that is submitted by the visitor; performs a defined action, and sends you the processed content via email. This information contained in the email is based on the ‘variable names’ you have assigned for each piece of information you ask the visitor to fill in, i.e., name, address, item for sale, price of item, etc. – you get the idea.

Some common applications for CGI are:

Forms– information collected is formatted and sent to the designated email(s). This email can be the web-master’s or multiple recipients.

Guestbook – the script accepts the entered data and creates the guestbook entry. In some cases the script can notify the webmaster by email an entry has been left or notify the writer via email their entry has been received.

Counters – maintain the number of visitors to a page.

The information to be gathered is typically contained with in standard HTML tags which is then passed along to the CGI routine. In order for any ‘CGI’ tags contained in an HTML document to work, there must be a script defining the action. This script is stored in the Root Directory CGI-Bin (this specified area allows for the execution of scripts and programs).    Note: Make sure your hosting provider has CGI capabilities.  You wouldn’t want to have to move your site once established just because you don’t have access to CGI.

There are many CGI scripts available on line for you to download and use. However, you should remember if you use one of these ‘generic’ scripts, you will need to customize it to work with your web-site’s IP address and emails before uploading to the CGI-Bin. Not doing so can result in a variety of errors.


  • JavaScripts is a scripting language that can be used to insert functionality into a web page.
  • JavaScript should not be confused with the Java programming language – they are not the same.
  • JavaScript is easy to use and many scripts can be found for free.

Using a JavaScript usually means you will have a code in the HEAD tag of your HTML document, as well as coding in the body of the document. Depending on what action the JavaScript performs, you may have an ‘onload event loader’ in the BODY tag. In every case I have found, when using on line JavaScripts – easy, detailed directions are given. And, remember if you want to preview your JavaScript, you will need to upload it. It cannot be previewed like a HTML document.

There are a wide variety of uses for JavaScripts, some of the more common ones are:

  • Functional buttons
  • Cookies
  • Games
  • Image effects
  • Navigation
  • Page details
  • Text effects
  • Time/Date
  • User details

Getting familiar with CGI and JavaScripts can not only make your web pages more interesting and user-friendly to visitors, but also can add different degrees of functionality that can be of benefit to you in monitoring and growing your online business.

Comments are closed.