HotJava(tm) Browser Viewer Applications

There are a multitude of file types out on the World Wide Web. When the HotJavaTM Browser encounters a file that it can't display in a Web page, it looks in a table of viewer applications to find out how to display the file based on its type. For example, when it encounters an audio file, it launches the appropriate audio player.

The HotJava Browser determines the type of a file by referencing its MIME (Multipurpose Internet Mail Extensions) type, which is sent to the browser from the http server along with the file. This tells HotJava the general type of file (text, audio, image, video, application, message, or multipart), and a more specific subtype (e.g. PostScript, TIFF, ZIP compressed data, and so on).

If a file's MIME type is not available (for example, if the file is loaded with a non-http protocol, such as the ftp or file protocol), HotJava uses the file's extension to map the file to a MIME type. The file extension is simply the last letters of the file name, which appear after a period. For example, a file named "myfile.txt" has ".txt" as its file extension, and maps to the text/plain MIME type.

The HotJava Browser uses a table of content type definitions, found on the Edit->Preferences->Viewer Applications page, to map content types (determined by MIME type or file extension) to viewer applications. The Action listed for each content type tells HotJava to do one of the following to display a file of that type:

1. Display the file within the HotJava Browser (HTML, ASCII text, GIF, and JPEG files). If the HotJava Browser doesn't have a content handler to display this type of file, it tries to display the file verbatim, that is, without special handling. Java programmers can write new content handlers to enable HotJava to display a particular type of file in the HotJava Browser.
2. Launch an external application to display the file (see the NOTE below).
3. Save the file to your local system.
4. Display a page to ask the user what to do with the file.

NOTE: You must tell HotJava where on your system to find your external applications by setting the exec.path property in your HotJava properties file. See Setting the exec.path Property for information.

To see how HotJava currently handles files of a particular type, select the type from the Content Types scrolling list. You can modify the following information for that content type by updating the fields to the right of the Content Types scrolling list, and clicking Apply:

- Description is what will appear in the Content Types scrolling list when the new type is added. Use any description that's meaningful to you.
- Extensions are the file extensions that files of this type are typically identified by (if the file's MIME type is not available). Separate multiple file extensions by commas.
- Action tells the HotJava Browser what to do with files of this type. There are four choices, as listed above.
- Application is used whenever the Action is View in Application. This is the external viewer that the HotJava Browser will invoke to view the file.

For example, suppose you want to add a new file extension, (.abc), to the list of Plain Text file extensions, so files with that extension will be treated as plain ASCII text. You can do this by selecting the Plain Text Content Type, adding ".abc" to the Extensions field, and clicking Apply. Remember, however, that the HotJava Browser first looks to the file's MIME type, not its extension. Thus if a file with the new extension is sent from an http server to the HotJava Browser along with a MIME type, the file's extension will be ignored.

To add a new Content Type, follow the steps below. These steps show an example of how you would either add support for a type of images called Raster images, using a viewer application called imagetool, or how you would add support for bitmap images using your Windows Paint application. You can use these steps to add support for any other file type and/or viewer application.

1. On the Edit->Preferences->Viewer Applications page, click on New.
   This activates the MIME type fields at the bottom of the page. It is important to fill out these MIME type fields, as well as the fields to the right of the Content Types scrolling list.

2. Type a description of the content type in the Description field. This is what will appear in the Content Types scrolling list when the new type is added.
   For the Raster file example, you might type `Raster File` in the Description field.
   For the bitmap file example, you might type `Paint Bitmap File` in the Description field.

3. Type in the file Extensions that files of this type are typically identified by. Separate multiple file extensions by commas.
   For the Raster file example, this might be `.ras, .rs`.
   For the bitmap file example, this might be `.bmp`.

4. Select an Action. For either of these examples, you would choose View in Application.

5. If you chose View in Application, the Application type-in field is activated. Type in the name of the application, or click on the Choose button to choose an application from your file system.
   For the Raster file example, you would type `imagetool`.
   For the bitmap file example, you would type `mspaint.exe` or `pbrush.exe`.

   NOTE: If you type in an application without the full path name to where the application is located on your file system, you must make sure the exec.path property is set. (See Setting the exec.path Property.) If you click on Choose to select an application, the full path name is entered into the Application field, so you don't need to be concerned about the exec.path property for this particular application.

6. Select the MIME Type for your new content type. Your choices are Application, Audio, Image, Message, Multipart, Text, or Video. For this example, choose Image.

7. Select a MIME Subtype from the Subtype scrolling list, or type in a description of the new content type after x- in the Subtype field. The scrolling list shows all the known Subtypes for the specified Type. If none of the known Subtypes is appropriate, type a description after the x-.
   For the Raster file example, you might type `x-rasterfile`.
   For the bitmap file example, you might type `x-bmp`.

   NOTE: If you select a MIME Type/Subtype combination that is already defined, your new definition (description, extensions, action, and application) will override the previous definition.

8. Click on the Apply button to activate your new Content Type.

   You should see your new definition in the Content Types scrolling list, and you can now access files of that type using the action you specified.

   If your Action was View in Application, you'll notice that the HotJava Browser appends %s at the end of the Application definition when you click on Apply. It uses the %s later to substitute the actual file being opened.

In some circumstances, the HotJava Browser creates temporary files to display content within the browser or to launch external applications. See Temporary Files for Viewer Applications for information about the location of these files, and how you can control whether or not some of these files are automatically deleted.

Back to HotJava User's Guide Table of Contents

Back to HotJava Browser Menus

Follow these links for information about other Preferences pages:

- Display
- Proxies (previous topic)
- Mail (next topic)
- SSL and Certificate Settings
- Applet Security