Lars Eighner wrote:
[color=blue]
> I'm using the HTML 4.01 strict DTD.[/color]
The longdesc attribute belongs to all HTML 4.01 DTDs. This does not make
it supported, or useful.
[color=blue]
> I have a few questions about the longdesc attribute when used
> with the IMG element.[/color]
The short answer is "Don't".
The medium-length answer is "Don't; use an explicit normal link instead."
The long answer is at
http://www.cs.tut.fi/~jkorpela/html/alt.html#longdesc
The technical details of longdesc are rather unimportant, but due to my
continued failures in resisting the temptation to get involved in
discussing irrelevant technicalities (a.k.a. "nitpicking"), here I go
again...
[color=blue]
> I understand that longdesc takes a uri for a value.[/color]
Yes, and "uri" is formalese for "URL" in practice, until URNs will be
implemented in a useful way.
[color=blue]
> 1) What kind of resource is appropriate for the uri to point to?
> A plain text file? An HTML document?[/color]
Either, or some other format, such as PDF document, or an image, though
many of the formats would surely be absurd in this context.
[color=blue]
> 1) a. If an HTML document, would that be one document per
> description, or could it be a name anchor in a page with many
> descriptions?[/color]
It could be a "name anchor", i.e. the URL can contain a fragment (e.g.,
longdesc="explanations.html#foobar"). The general idea in the HTML specs
has always been to allow fragments wherever URLs are allowed, although
formally they made authoritative references to RFCs that defined "URL"
differently. That's all water under bridge now: the Internet-standard on
generic URI format defines a fragment part of a URI.
[color=blue]
> 1) b. If several document types are possible, is there a way to
> indicate the content type(s) of longdescs used in a page.[/color]
The browser is expected to recognize the media type from the HTTP
headers sent by the server for the URL requested. There's nothing you
can say about this in the <img> element.
Some HTML constructs contain a type="..." attribute for suggesting a
media type for a linked resource, but a) this hasn't been implemented,
b) it was not meant to replace the HTTP mechanism but to augment it with
an "advance hint", c) it's not defined for an <img> element (and it
wouldn't be logical to do so, since it would be much more natural to
have a type="..." attribute specify the media type of the image).
[color=blue]
> 2) If the uri is relative, is it relative to the image or to the
> page on which IMG occurs? I guess the latter, but want to be
> sure.[/color]
The latter, as all URLs in URL-type attributes.
[color=blue]
> 3) Are there any user-agents in current release that actually
> treat longdesc in an appropriate manner, including cases in
> which IMG is in A?[/color]
None that I know of.
[color=blue]
> 4) Should longdesc be omitted or be empty for purely decorative
> images or images adequately described with alt?[/color]
The specification rather clearly implies that, since the longdesc
attribute is described as giving additional information when the alt
attribute does not give enough info.
In reality, it should be omitted always, except perhaps in an
environment where HTML documents are processed by a program that makes
some meaningful use of the attributes. (I can't imagine useful
applications right now, but they might well exist.)