Re: W3A - update and questions

Steven Miale (
Mon, 01 Aug 1994 10:11:38 -0500

Bert Bos wrote:
> I've really tried to omit windows from the W3A API, but I can't find a
> solution. I don't quite understand the paragraph above: the
> browser is able to tell the viewer which window to use, but it
> needs no new protocol for that? Can you explain?
> The model in my head is:
> - viewers are tied to Content-Type
> - a particular instance of a viewer for a particular document is
> tied to a particular window (the instance is discarded afterwards)
> - the browser deals out screen space (rectangular areas within the
> boundaries of which viewer instances can do what they want)

I have a similar model in mind; when a document is recieved, it is sent out
to different modules depending on the content type. So anything with a type
of 'text/html' would be sent to the HTML browser, one with 'image/gif' would
be sent to a GIF viewer, etc.

The HTML browsing module consists of two parts: a dispatcher and one or more
viewers. The dispatcher has a mapping table associated with it; when a document
comes in, it looks in the table to see which viewer that document should be
sent to. If there is an entry, it sends the document there; otherwise it
creates a new viewer. Here is part of the code:


def Register(url, callback):

def Display(url, name, (file, header)):
data = getdata(file)
if url in url_index.keys():
showurl = url_index[url]
del url_index[url]
showurl(name,data, file, header)
window = HTMLWindow()
window.showurl(name, data, file, header)

RegisterExtension(('html','text'), Display)
RegisterContentType(('text/html','text/plain'), Display)

When 'Display' is called, it checks the index to see if the document's
URL (HREF? I'm not sure of the correct terminology) has been registered; if
so, it sends the document to that window. Otherwise, it creates a new window
and sends the document there.

Of course, this requires that a document's URL be registered if you want it
to appear in the same window.

> Steve, you seem to suggest that :
> - there is only one viewer instance, which handles all docs of a
> particular type (you say `URL' but that can't be right)

Sorry; wrong word. Content types are linked to a particular module which
it; there may be multiple content types that can be displayed with a particular

> - its single window is registered with the browser by some means
> outside of the program (you say `HTML browser', don't you mean
> `WWW browser'?)

There can be multiple windows. I'm not sure whether the correct terminology
is "HTML browser" or "WWW browser"; I'm referring specifically to a browser
which displays HTML (and text/plain, but that isn't important to the topic
at hand.)

> - in-lined material

If you mean tags like <IMG SRC=...>, the model allows you to specify a callback
when the document has been retrieved, instead of the normal handling. (This
is how downloading is implemented; the document is requested with a callback
saving the data on disk instead of trying to create a viewer for it.)

Hope this helps,