mozilla

Revision 432433 of <applet>

  • Revision slug: Web/HTML/Element/applet
  • Revision title: <applet>
  • Revision id: 432433
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment

Revision Content

{{obsolete_header}}

Summary

The HTML Applet Element (<applet>) identifies the inclusion of a Java applet.

Usage note: This element has been removed in HTML5 and shouldn't be used anymore. Instead web developers should use the more generic {{HTMLElement("object")}} element.

Attributes

{{htmlattrdef("align")}}
This attribute is used to position the applet on the page relative to content that might flow around it. The HTML 4.01 specification defines values of bottom, left, middle, right, and top, whereas Microsoft and Netscape also might support absbottom, absmiddle, baseline, center, and texttop.
{{htmlattrdef("alt")}}
This attribute causes a descriptive text alternate to be displayed on browsers that do not support Java. Page designers should also remember that content enclosed within the <applet> element may also be rendered as alternative text.
{{htmlattrdef("archive")}}
This attribute refers to an archived or compressed version of the applet and its associated class files, which might help reduce download time.
{{htmlattrdef("code")}}
This attribute specifies the URL of the applet's class file to be loaded and executed. Applet filenames are identified by a .class filename extension. The URL specified by code might be relative to the codebase attribute.
{{htmlattrdef("codebase")}}
This attribute gives the absolute or relative URL of the directory where applets' .class files referenced by the code attribute are stored.
{{htmlattrdef("datafld")}}
This attribute, supported by Internet Explorer 4 and higher, specifies the column name from the data source object that supplies the bound data. This attribute might be used to specify the various {{HTMLElement("param")}} elements passed to the Java applet.
{{htmlattrdef("datasrc")}}
Like datafld, this attribute is used for data binding under Internet Explorer 4. It indicates the id of the data source object that supplies the data that is bound to the {{HTMLElement("param")}} elements associated with the applet.
{{htmlattrdef("height")}}
This attribute specifies the height, in pixels, that the applet needs.
{{htmlattrdef("hspace")}}
This attribute specifies additional horizontal space, in pixels, to be reserved on either side of the applet.
{{htmlattrdef("mayscript")}}
In the Netscape implementation, this attribute allows access to an applet by programs in a scripting language embedded in the document.
{{htmlattrdef("name")}}
This attribute assigns a name to the applet so that it can be identified by other resources; particularly scripts.
{{htmlattrdef("object")}}
This attribute specifies the URL of a serialized representation of an applet.
{{htmlattrdef("src")}}
As defined for Internet Explorer 4 and higher, this attribute specifies a URL for an associated file for the applet. The meaning and use is unclear and not part of the HTML standard.
{{htmlattrdef("vspace")}}
This attribute specifies additional vertical space, in pixels, to be reserved above and below the applet.
{{htmlattrdef("width")}}
This attribute specifies in pixels the width that the applet needs.

Example

<applet code="game.class" align="left" archive="game.zip" height="250" width="350">
  <param name="difficulty" value="easy">
  <b>Sorry, you need Java to play this game.</b>
</applet>

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatNo}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatNo}} {{CompatVersionUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mini Opera Mobile Safari Mobile
Basic support {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}}

Notes

The W3C specification does not encourage the use of <applet> and prefers the use of the {{HTMLElement("object")}} tag. Under the strict definition of HTML 4.01, this element is deprecated and entirely obsolete in HTML5.

{{HTML:Element_Navigation}}

Revision Source

<div>
  {{obsolete_header}}</div>
<h2 id="Summary">Summary</h2>
<p>The HTML Applet Element (<code>&lt;applet&gt;</code>) identifies the inclusion of a Java applet.</p>
<div class="note">
  <p><strong>Usage note: </strong>This element has been removed in HTML5 and shouldn't be used anymore. Instead web developers should use the more generic {{HTMLElement("object")}} element.</p>
</div>
<h2 id="Attributes" name="Attributes">Attributes</h2>
<dl>
  <dt>
    {{htmlattrdef("align")}}</dt>
  <dd>
    This attribute is used to position the applet on the page relative to content that might flow around it. The HTML 4.01 specification defines values of bottom, left, middle, right, and top, whereas Microsoft and Netscape also might support <strong>absbottom</strong>, <strong>absmiddle</strong>, <strong>baseline</strong>, <strong>center</strong>, and <strong>texttop</strong>.</dd>
  <dt>
    {{htmlattrdef("alt")}}</dt>
  <dd>
    This attribute causes a descriptive text alternate to be displayed on browsers that do not support Java. Page designers should also remember that content enclosed within the <code>&lt;applet&gt;</code> element may also be rendered as alternative text.</dd>
  <dt>
    {{htmlattrdef("archive")}}</dt>
  <dd>
    This attribute refers to an archived or compressed version of the applet and its associated class files, which might help reduce download time.</dd>
  <dt>
    {{htmlattrdef("code")}}</dt>
  <dd>
    This attribute specifies the URL of the applet's class file to be loaded and executed. Applet filenames are identified by a .class filename extension. The URL specified by code might be relative to the <code>codebase</code> attribute.</dd>
  <dt>
    {{htmlattrdef("codebase")}}</dt>
  <dd>
    This attribute gives the absolute or relative URL of the directory where applets' .class files referenced by the code attribute are stored.</dd>
  <dt>
    {{htmlattrdef("datafld")}}</dt>
  <dd>
    This attribute, supported by Internet Explorer 4 and higher, specifies the column name from the data source object that supplies the bound data. This attribute might be used to specify the various&nbsp;{{HTMLElement("param")}} elements passed to the Java applet.</dd>
  <dt>
    {{htmlattrdef("datasrc")}}</dt>
  <dd>
    Like <code>datafld</code>, this attribute is used for data binding under Internet Explorer 4. It indicates the id of the data source object that supplies the data that is bound to the {{HTMLElement("param")}} elements associated with the applet.</dd>
  <dt>
    {{htmlattrdef("height")}}</dt>
  <dd>
    This attribute specifies the height, in pixels, that the applet needs.</dd>
  <dt>
    {{htmlattrdef("hspace")}}</dt>
  <dd>
    This attribute specifies additional horizontal space, in pixels, to be reserved on either side of the applet.</dd>
  <dt>
    {{htmlattrdef("mayscript")}}</dt>
  <dd>
    In the Netscape implementation, this attribute allows access to an applet by programs in a scripting language embedded in the document.</dd>
  <dt>
    {{htmlattrdef("name")}}</dt>
  <dd>
    This attribute assigns a name to the applet so that it can be identified by other resources; particularly scripts.</dd>
  <dt>
    {{htmlattrdef("object")}}</dt>
  <dd>
    This attribute specifies the URL of a serialized representation of an applet.</dd>
  <dt>
    {{htmlattrdef("src")}}</dt>
  <dd>
    As defined for Internet Explorer 4 and higher, this attribute specifies a URL for an associated file for the applet. The meaning and use is unclear and not part of the HTML standard.</dd>
  <dt>
    {{htmlattrdef("vspace")}}</dt>
  <dd>
    This attribute specifies additional vertical space, in pixels, to be reserved above and below the applet.</dd>
  <dt>
    {{htmlattrdef("width")}}</dt>
  <dd>
    This attribute specifies in pixels the width that the applet needs.</dd>
</dl>
<h2 id="Example">Example</h2>
<pre class="brush: html">
&lt;applet code="game.class" align="left" archive="game.zip" height="250" width="350"&gt;
  &lt;param name="difficulty" value="easy"&gt;
  &lt;b&gt;Sorry, you need Java to play this game.&lt;/b&gt;
&lt;/applet&gt;
</pre>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mini</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="Notes">Notes</h2>
<p>The W3C specification does not encourage the use of <code>&lt;applet&gt;</code> and prefers the use of the {{HTMLElement("object")}} tag. Under the strict definition of HTML 4.01, this element is deprecated and entirely obsolete in HTML5.</p>
<div>
  {{HTML:Element_Navigation}}</div>
Revert to this revision