Content Viewer Preferences

Note: The Content Viewers feature is not available on all platforms. If the Edit->Content Viewer Preferences option is missing, (for example, if you are running &browser.name.prefix;TM &browser.name.suffix; on the JavaStationTM platform), the information on this page does not apply to your browser.

There are a multitude of file types on the World Wide Web. When &browser.name; encounters a file that it can't display in a web page, it looks in a table of Content Types 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 information you set on the Content Viewer Preferences page tells &browser.name; to do one of the following things when it encounters a file of a specific type:

&browser.name; 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 &browser.name; the general type of file (text, audio, image, video, application, message, or multipart), and a more specific subtype (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), &browser.name; 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.

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

  1. Display the file within &browser.name; (typically HTML, ASCII text, GIF images, and JPEG files). If &browser.name; doesn't have a content handler to display this type of file, it tries to display the file verbatim, that is, without special handling.

  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 you what to do with the file.

Note: You must tell &browser.name; where on your system to find your external applications by setting the exec.path property in your &browser.name; properties file. See Setting the exec.path Property for information.

To see how &browser.name; 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 OK:

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 OK. Remember, however, that &browser.name; 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 &browser.name; 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 add support for a type of images called raster images, using a viewer application called imagetool. You can use these steps to add support for any other file type and/or viewer application.

  1. On the Content Viewer Preferences page, click New.
    This activates the MIME type fields at the right side of the page. Be sure to fill out these MIME type fields (Type and Subtype), as well as the other 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.

  3. Type the file Extensions that are usually in the names of files of this type. You should separate multiple file extensions by commas.
    For the raster file example, this might be .ras, .rs.

  4. Select an Action. For this example, you would choose View in Application.

  5. If you chose View in Application, the Application type-in field is activated. Type 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.

    Note: If you type an application without the full path name 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 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 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.

    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 the OK 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 &browser.name; appends %s at the end of the Application definition when you click OK. It uses the %s later to substitute the actual file being opened.

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


Table of Contents INDEX

Copyright © Sun Microsystems, Inc.