Non-HTML Documents

Contents

  1. The WEB mechanism
  2. MIME-types

The WEB mechanism

First we explain what happens when you load a HTML-file with a WEB-browser over the Internet?

  1. First a connection is established with the WEB server, i.e. the specified remote host. Information about the protocol is included.
  2. Then a so-called "GET" request is sent over together with the specified location.
  3. The WEB server responds by sending over the HTML-file, just as a string of characters.
  4. Then the connection is closed.
  5. Meanwhile, your browser will put the HTML-file in memory and will start displaying it.

So probably when you are reading the file, the connection is already closed. This is why you have to reload a file when a change is made to it. Many browsers will even cache the file, i.e. write the document temporarily to a disk. So sometimes, especially when you are working with scripts, you have to clear the cache as well.


MIME Types

The WEB mechanism allows to send other files than just HTML files. By default the browser will allow you to save the file on a local disk in such a case. But it is possible to start an application on your local machine as well. For instance, if the file is a MS Word document, than it may start MS Word right away, or, if it is a dvi-file, it may start a dvi viewer.

The browser knows what to do by looking at the extension of the file. The extension of a file is the subpart of the name after the last dot, like txt in myfile.txt. The protocol for this communication is the same as that of MIME (Multipurpose Internet Mail Extensions) which is used by the Internet mail to append non-ASCII files to email messages. Both the server and the browser must be aware of the application that belongs to an extension.

On Windows and Apple platforms, the operating system allows so-called associations based on the extension, and those are used by the browser. On UNIX platforms, the browser uses two files in your home directory, .mime.types and .mailcap to start an application on the base of an extension. Suppose we have a DVI file called chapter1.dvi.

.mime.types
is an ASCII file that connects an extension to an application; to connect the DVI file to a dvi-application, the file contains a line like
application/x-dvi              dvi             
.mailcap
is an ASCII file that tells how to start the application. It shows the name and the path and possible parameters of the application. To start up a the DVI-viewer xdvi the .mailcap reads for instance
application/x-dvi; xdvi %s

So if you have this set up in the right way, then a little DVI file should show up by activating the link. If not, you are allowed to save the file, and that is all.


Back Back to HTML Course Contents