APPLET tag's ALT attribute?

E. Stephen Mack (estephen@emf.net)
Sun, 17 Aug 1997 21:10:49 -0700


Message-Id: <3.0.3.32.19970817211049.006a9fcc@emf.net>
Date: Sun, 17 Aug 1997 21:10:49 -0700
To: www-html@w3.org
From: "E. Stephen Mack" <estephen@emf.net>
Subject: APPLET tag's ALT attribute?

The HTML 3.2 specification allows the APPLET element to take
an ALT attribute [1], and says:

> alt = alternateText 
> This optional attribute specifies any text that should be displayed
> if the browser understands the APPLET tag but can't run Java applets.

This seems to give a distinction between an APPLET element's content and
its ALT attribute value that is not present in HTML 4.0.

The HTML 4.0 draft specification says [2]:

> alt = cdata 
> For user agents that cannot display images, forms, or applets, this
> attribute specifies alternate text.

However, the APPLET element's content is also displayed by
browsers that cannot display APPLETs, as shown in [3]:

> The content of the APPLET acts as alternate information for user
> agents that don't support this element or are currently
> configured not to support applets. The content must be ignored
> otherwise. 

This is either redundant or duplicated by the ALT attribute;
the HTML 4.0 does not clarify the distinction.

Should a user-agent that understands the APPLET element
but is currently configured not to enable Java display both
the APPLET element's content and the ALT attribute value?
It depends what the draft means by "*can't* run Java APPLETs."

Should new versions of Lynx, which recognize that APPLET is
a valid element but can't render its content, display the
content, the ALT value, or both?

Or should such all user agents only display the ALT tag?  If so,
that is not the behavior of current browsers.  Navigator 4.02 Win95
displays the contents of an APPLET element when Java is disabled,
but not the ALT attribute's value.

IE 4.0pp2 seems to display the applet's rectangle and displays
neither the ALT attribute's value nor the content of the APPLET
element.

I haven't done further tests, but it isn't clear to me from
the HTML 4.0 draft how a user agent should behave.

There's this section of the HTML 4.0 draft [further down in 2]:

> When an author does not set the alt attribute for the IMG or APPLET
> elements, user agents should supply the alternate text, calculated
> in the following order: 
> 1. If the title has been specified, its value should be used as
> alternate text. 
> 2. Otherwise, if HTTP headers provide title information when the
> included object is retrieved, this information should be
> used as alternate text.
> 3. Otherwise, if the included object contains text fields (e.g., GIF
> images contain some text fields), information extracted
> from the text fields should be used as alternate text. Since user
> agents may have to retrieve an entire object first in order
> to extract textual information, user agents may adopt more 
> economical approaches (e.g., content negotiation). 
> 4. Otherwise, in the absence of other information, user agents should
> use the file name (minus the extension) as alternate text. 

Rule 1 doesn't apply because the <APPLET> tag can't be used with a
TITLE attribute.

Rule 2 may apply, but won't in most cases.

Does 3 refer to the APPLET's content?  If so, it should be more
explicit.

Given rule 4, does that mean that if I use:

<APPLET CODE="Foo.class" WIDTH="200" HEIGHT="200">
This Java demonstration requires a Java-enabled browser, sorry.
There's an <A href="alternate.html">alternate</A> version.
</APPLET>

...that a compliant user agent should display:

Foo This Java demonstration [...etc.]
^^^
   \_____should be displayed due to rule 4.

That seems strange to me.  Perhaps this section could be amended
to consider the content of the APPLET element.

I realize that the APPLET element is deprecated in HTML 4.0.  But
it is not yet obsolete; given the implementation problems with the
OBJECT element in current popular browsers, many Java authors will
continue to use the APPLET element in HTML 4.0 documents for some
time to come.

The OBJECT element does not take an ALT attribute and uses the
element's content as the sole alternate presentation model.
APPLET is a case where the old practice and the new practice
collide, since both alternate content and an ALT attribute are legal.

[1] http://www.w3.org/TR/REC-html32.html#applet
[2] http://www.w3.org/TR/WD-html40-970708/includes.html#adef-alt
[3] http://www.w3.org/TR/WD-html40-970708/includes.html#edef-APPLET
-- 
E. Stephen Mack <estephen@emf.net>    http://www.emf.net/~estephen/