Using a Hyperlink to Launch Your Application

You can use the HTML anchor tags, <A> and </A>, to create a link to your COBOL application in the HTML document.

Anchor tags are closed elements that highlight text or images. When users click a highlighted item on your Web page, they are transferred to the linked document. Because the link in this case is a COBOL program, when users click the highlighted item, the COBOL program is automatically invoked.

To run your COBOL application in a separate window using the anchor tags, you must set up the standard ACUCOBOL-GT runtime as a helper application as described in Use the Runtime as a Helper Application or Viewer. To run your COBOL application in a separate window with the Web runtime, use the <EMBED> tag, the <OBJECT> tag, or the scripting method.

To turn text into a hypertext anchor, enclose the text in the anchor tags. The browser usually displays it underlined and in a different color. For example, your HTML document may include this:

<A HREF="myprog.acu">Click here to run the application</A>

The "HREF" attribute is used within the starting anchor tag to specify the document to be linked (or retrieved). Then when the user clicks on the highlighted text, "Click here to run the application," on your Web page, the COBOL object "myprog.acu" is retrieved from the specified location on the Web server and run inside the user's browser window.

To use images as hypertext anchors, you place the <IMG> element within the Anchor tags. For example:

<A HREF="myprog.acu">
<IMG SRC="myprog.gif" ALT="Click here to run application">
</A>

Then when the user clicks on the "myprog.gif" image on your Web page, the COBOL object "myprog.acu" is retrieved from the specified location on the Web server and run inside the user's browser window. While the graphic file is loading (or if the user's browser does not support images), the browser displays the alternate text, "Click here to run the application". Clicking this text invokes the application as before.

If you use a hyperlink to invoke the Web runtime, you must also configure your Web server software to generate the appropriate response header when it sends the object files to the client. The extension ".acu" has been registered as a MIME content type that is embedded in the Web runtime. The end user's browser will execute the Web runtime only if the MIME content type field of your response header contains "application/vnd.acucobol". For this reason, be sure to add a new File Extension/MIME Content Type mapping for ".acu" and "application/vnd.acucobol". Your Web server software provides instructions for making MIME Content Type associations.