Tutorial 12: Embed with HTML - Page 3 - HTML with Style
Tutorial 12: Embed with HTML - Page 3
Attributes for the OBJECT element
- classid (URI)
- The location of an object's
implementation, that is, the code that needs to be run for the object
to work if the object is some kind of applet or program.
- data (URI)
- A URI pointing to the actual object
data. If this is a multimedia object, this should point to the actual
file. If it is some sort of applet, this attribute could point to data
used by the code.
- codetype (content type)
- The content type of the
object code specified by the classid attribute. Common MIME
content types for code are application/java for Java classes,
application/x-shockwave-flash for Shockwave Flash files,
etc.
- type (content type)
- The content type of the
data specified by the data attribute. Common MIME content types
for multimedia objects are image/png, image/gif,
image/jpeg, video/mpeg, audio/x-wav
etc.
- codebase (URI)
- The base URI used to resolve the
URIs specified in the classid, archive and data
attributes, if it is different from the document's base
URI.
- archive (URI list)
- This space-separated list of
URIs points to archives that may contain data used by the object. The
specifics of this attribute depend largely on the type of object. Most
commonly, it is used for Java Archives (JAR files).
- declare (boolean)
- When this attribute is
specified, the object is not displayed, but is only loaded and
prepared for use. This technique is useful (or will be useful, if it
is ever implemented) so that you can pre-load object data that is used
by other objects.
- standby (text)
- This attribute is used to
specify a message to be displayed while the object is being loaded and
prepared. Something along the lines of "Loading image..." or
"Initializing applet..." is suitable.
- Attributes for specifying image maps
- Object presentational attributes
- Identifier and classification attributes
- Title attribute
- Language information attributes
- Inline style information attribute
- Intrinsic event handler attributes
- Tabbing navigation attribute
- Form control naming attribute
The OBJECT element has a long and painful history. It was only recently added to HTML in the HTML 4.0 specification, although the proposal has been hanging around for quite some time. OBJECT is unimplemented in all versions of Internet Explorer and Netscape Navigator. Mozilla has support for OBJECT, but it's still experimental. However, that isn't half the story.
The trouble arises with one particular browser, Internet Explorer 3.0. Microsoft introduced the OBJECT element in that browser as a means to embed a certain type of object called an ActiveX control. ActiveX controls are small Windows software components similar to Java applets in many respects except for the fact that they only work under Windows. Although the ActiveX revolution never quite reached the Web, the implementation in Internet Explorer 3.0 had a certain rather large bug.
This is no ordinary bug. If your average "oops I collapsed some CSS paddings here" bug is equivalent to a little ant out of a Disney movie, this bug would look like some skyscraper-sized, many-legged, buzzing monster bug trampling through downtown in a B-movie. It basically boiled down to this: If Internet Explorer 3.0 encounters an OBJECT element that is used for anything other than an ActiveX control, it promptly crashes, gives the user a cryptic error message and then dies horribly with no explanation. In other words, unless you want to get your mailbox filled with messages from people telling you how your Web page crashes their browser, you should probably steer clear of OBJECT for now. In a year or two, when Internet Explorer 3.0 will hopefully have been phased out of the market, you can re-consider. But for now, this discussion is largely theoretical in nature.
Let's take a brief look at how you can use the OBJECT element. In its simplest form, you can include an image with something like this:
<OBJECT DATA="image.png" TYPE="image/png"> </OBJECT>
This will embed the PNG (Portable Network Graphics, an excellent graphics format for the Web) image at that point in the document. What we do is we tell the browser that there is an object that can be found in the (relative) URI image.png, and that this object is of type image/png. The browser can look at the type, and decide whether it can render the object in question. If it feels lucky, it will probably download the image and display it. But what if it doesn't?
Produced by Stephanos Piperoglou
URL: https://www.webreference.com/html/tutorial12/3.html
Created: May 28, 1998
Revised: February 25, 1999