codebase (HTML attribute)

Spec
Depr. Version
Yes HTML 2

Syntax

codebase="URL for base referencing"

Description

The codebase attribute is used to set the base URL for the value specified in the code attribute, overriding any base URL set in the head of the document.

Using the example shown, the codebase is identified as "http://java-apps-r-us.com/classes/", while the code refers to a file entitled "ticker.class". The full address for the ticker code would therefore be interpreted as being "http://java-apps-r-us.com/classes/ticker.class". If this attribute is not specified then the document’s URL is used.

Example

The codebase defining the base URL:

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

Value

URI, may be a complete path on another server (e.g. "http://java-apps-r-us.com/classes/", or could be a different folder on the same server, e.g.:

<applet code="ticker.class"
codebase="/code/java/classes/">
</applet>

Compatibility

Every browser listed supports this attribute.

User-contributed notes

There are no comments yet.

Related Products