HTML and CSS Reference
In-Depth Information
12.2.1.2. The codebase attribute
Use the
codebase
attribute to provide an alternative base URL from which
the browser should retrieve an object. The value of this attribute is
a URL pointing to a directory containing the object referenced by the
classid
attribute. The
codebase
URL overrides, but does not permanently
replace, the document's base URL, which is the default if you don't use
codebase
. [
Referencing Documents: The URL, 6.2
]
Continuing with our previous examples, suppose your document comes
from
http://www.kumquat.com
, but the clock applet is kept in a separ-
ate directory named
classes
. You cannot retrieve the applet by specify-
ing
classid="classes/clock.class"
. Rather, include the
codebase
attrib-
ute and new base URL:
<object classid="clock.class" codebase="http://www.kumquat.com/classes/">
</object>
which resolves to the URL:
http://www.kumquat.com/classes/clock.class
Although we used an absolute URL in this example, you also can use
a relative URL. For instance, applets typically are stored on the same
server as the host documents, so we'd usually be better off, for reloca-
tion's sake, specifying a relative URL for the
codebase
, such as:
<object code="clock.class" codebase="/classes/">
</object>
The
classid
attribute is similar to the
code
attribute of the
<applet>
tag,
providing the name of the file containing the object; it is used in con-