code (HTML attribute)

Spec
Depr. Version
Yes HTML 2

Syntax

code="URL of Java class file"

Description

The code attribute tells the browser the file name of the Java class required. It combines that with the path specified in the codebase attribute to ascertain the full URL. (in the example above, it would be "http://java-apps-r-us.com/classes/ticker.class". Note this file is relative to the base URL of the applet and cannot be absolute. Either code or object must be present.

Example

The code attribute defines the filename as "ticker.class":

<applet code="ticker.class"
codebase="http://java-apps-r-us.com/classes/">
</applet>

Value

The Java class filename in the format "name.class" or "packagename.classname.class" (if the .class suffix is omitted, the browser may append it automatically).

Compatibility

It causes no compatibility issues, and has excellent support across all tested browsers.

User-contributed notes

There are no comments yet.

Related Products