<EMBED>NN 2   IE 3   HTML n/a
<EMBED>...</EMBED>End Tag: Required
 

An EMBED element allows you to load media and file types other than those natively rendered by the browser. Typically, such external data requires a plugin or helper application to properly load the data and display its file. Notice that this element has been supported by both Navigator and Internet Explorer since Versions 2 and 3, respectively, but the element is still not a part of the HTML standard vocabulary. The HTML 4.0 specification recommends the OBJECT element as the one to load the kind of external data covered by the EMBED element in the browsers. Navigator 4 and Internet Explorer 4 also support the OBJECT element, and you should gravitate toward that element for embedded elements if your visitor browser base can support it.

Bear in mind that for data types that launch plugins, the control panel displayed for the data varies widely among browsers, operating systems, and the plugins the user has installed for that particular data type. It is risky business trying to carefully design a layout combining a plugin's control panel and surrounding text or other elements.

The list of attributes for the EMBED element is a long one, but pay special attention to the browser compatibility rating for each attribute. Because the plugin technologies of the two browsers are not identical, neither are the attribute sets. Even so, it is possible to assign an EMBED element in one document that works on both browser brands when the embedded element does not rely on an attribute setting not supported in one of the browsers. Some plugins, however, may require or accept attribute name/value pairs that are not listed for this element. At least in the case of Navigator, all attributes (including those normally ignored by the browser) and their values are passed to the plugin. Therefore, you must also check with the documentation for a plugin to determine what, if any, extra attributes may be supported. The OBJECT element gets around this object-specific attribute problem by letting you add any number of PARAM elements tailored to the object.

The end tag is required in Internet Explorer but is optional in Navigator.

 
Example
<EMBED NAME="jukebox" SRC="jazz.aif" HEIGHT=100 WIDTH=200></EMBED>
 
Object Model Reference
NN [window.]document.elementName
IE [window.]document.all.elementID
ALIGNNN all   IE 4   HTML n/a
ALIGN="where"Optional
 

If the embedded object (or player control panel) occupies space on the page, the ALIGN attribute determines how the object is rendered in physical relation to the element's next outermost container. If some additional text is specified between the start and end tags of the EMBED element, the ALIGN attribute also affects how that text is rendered relative to the object's rectangular space.

Most of the rules for alignment constant values cited at the beginning of this chapter apply to the EMBED element. Precise layout becomes difficult because the HTML page author usually isn't in control of the plugin control panel that is displayed on the page. Dimensions for the element that work fine for one control panel are totally inappropriate for another. (Compare Netscape's stocky audio control panel to the narrow horizontal slider in Internet Explorer.)

Typically, ALIGN attributes are deprecated in HTML 4.0 in favor of the align: style sheet attribute. But if you are using the EMBED element for backward compatibility, stick with the ALIGN attribute.

 
Example
<EMBED SRC="jazz.aif" ALIGN="left" HEIGHT=100 WIDTH=200></EMBED>
 
Value
Each browser defines a different set of values for this attribute. Select the one(s) from the following table that work for your deployment:
Value NN 4 IE 4
absbottom
- *
absmiddle
- *
baseline
- *
bottom
* *
left
* *
middle
* *
right
* *
texttop
- *
top
* *
 
Default bottom
 
Object Model Reference
IE [window.]document.all.elementID.align
ALTNN n/a   IE 4   HTML n/a
ALT="textMessage"Optional
 

If Internet Explorer does not have the facilities to load and run the external media, the text assigned to the ALT attribute is supposed to display in the document where the EMBED element's tag appears. Typically, this text provides advice on what the page visitor is missing by not being able to load the data (although IE also presents a dialog about how to get plugin information from an online source).

Use the ALT attribute with care. If the external data is not a critical part of your page's content, you may just want the rest of the page to load without calling attention to the missing media controller in lesscapable browsers. The alternate message may be more disturbing to the user than a missing media player.

The equivalent powers are available in Navigator with the NOEMBED element.

 
Example
<EMBED SRC="jazz.aif" ALT="Sound media player" HEIGHT=10 WIDTH=20></EMBED>
 
Value
Any quoted string of characters.
 
Default None.
BORDERNN 2   IE n/a   HTML n/a
BORDER=pixelsOptional
 

Navigator provides a dedicated attribute to specifying the thickness of a border around an EMBED element. This feature does not appear to be working in Navigator 4. Also, when the EMBED element has style sheet attributes, setting a border for the element results in a floating border around a small square outside of the EMBED element's area.

 
Example
<EMBED SRC="jazz.aif" BORDER=3 HEIGHT=150 WIDTH=250></EMBED>
 
Value
Any integer pixel value.
 
Default None.
CODENN n/a   IE 4   HTML n/a
CODE="fileName.class"Required
 

I'm not sure why Microsoft specifies the CODE attribute for the EMBED element. Typically, a CODE attribute points to a Java class filename. In theory, an applet could be loaded into a document via the EMBED element (rather than the APPLET or OBJECT element), but this approach does not work in IE 4. Nor does the CODEBASE element help the browser find a Java applet class filename assigned to the SRC attribute. My recommendation is to avoid this attribute.

CODEBASENN n/a   IE 4   HTML n/a
CODEBASE="path"Optional
 

As with the CODE attribute, Internet Explorer 4 seems to ignore the CODEBASE attribute for the EMBED element, despite its apparent support in the SDK documentation. The SRC attribute must contain the path to the data file because it does not rely on the CODEBASE attribute value. My recommendation is to avoid this attribute.

FRAMEBORDERNN 2   IE n/a   HTML n/a
FRAMEBORDER="yes" | "no"Optional
 

Predating style sheet borders, the FRAMEBORDER attribute is a switch that lets you turn on a plugin control panel's border (whose thickness is set by the BORDER attribute). This attribute does not appear to work in Navigator 4, nor does a style sheet border do what you'd expect it to do.

 
Example
<EMBED SRC="jazz.aif" FRAMEBORDER="no" HEIGHT=150 WIDTH=250></EMBED>
 
Value
yes | no
 
Default yes
HEIGHT, WIDTHNN 2   IE 3   HTML n/a
HEIGHT="length"
WIDTH="length"
Required
 

The size that an embedded object (or its plugin control panel) occupies in a document is governed by the HEIGHT and WIDTH attribute settings. Some browser versions might allow you to get away without assigning these attributes, letting the plugin's own user interface design determine the height and width of its visible rectangle. It is best to specify the exact dimensions of a plugin's control panel whenever possible. (Control panels vary with each browser and even between different plugins for the same browser.) In some cases, such as Navigator 4 for the Macintosh, the control panel does not display if you fail to supply enough height on the page for the control panel. If you assign values that are larger than the actual control panel, the browser reserves that empty space on the page, which could interfere with your intended page design.

 
Example
<EMBED SRC="jazz.aif" HEIGHT=150 WIDTH=250></EMBED>
 
Value
Positive integer values (optionally quoted) or percentage values (quoted). You cannot entirely hide an embedded object's control panel by setting values to zero (one pixel always shows and occupies space), but you can reduce its height and width to one pixel in each dimension. If you want to hide a plugin, do so with DHTML by setting its positioning display attribute to none. Navigator also includes a HIDDEN attribute that is backward compatible for that browser brand.
 
Default None.
 
Object Model Reference
IE [window.]document.embeds[i].height
[window.]document.elementID.height
[window.]document.embeds[i].width
[window.]document.elementID.width
HIDDENNN 2   IE 4   HTML n/a
HIDDEN="true" | "false"Optional
 

Predating style sheet borders, the HIDDEN attribute is a switch that lets you set whether the embedded data's plugin control panel appears on the screen. This might be desirable for background music under script control (via Netscape's LiveConnect). When you set the HIDDEN attribute, the HEIGHT and WIDTH attributes are overridden.

 
Example
<EMBED SRC="soothing.aif" HIDDEN></EMBED>
 
Value
true | false
 
Default false
 
Object Model Reference
IE [window.]document.embeds[i].hidden
[window.]document.elementID.hidden
HSPACE, VSPACENN 2   IE 3   HTML n/a
HSPACE=pixelCount
VSPACE=pixelCount
Optional
 

Predating style sheet margins, the HSPACE and VSPACE attributes let you define a margin that acts as whitespace padding around the visual content of the EMBED element. HSPACE establishes a margin on the left and right sides of the rectangle; VSPACE establishes a margin on the top and bottom sides of the rectangle. This attribute appears to work in Navigator 4 but not in Internet Explorer 4. With these attributes not reflected as scriptable properties of an EMBED element, it is likely that these attributes are truly not supported in IE 4, Microsoft's SDK notwithstanding.

 
Example
<EMBED SRC="soothing.aif" VSPACE=10 HSPACE=10></EMBED>
 
Value
Integer representing the number of pixels for the width of the margin on the relevant sides of the EMBED element's rectangle.
 
Default 0
IDNN n/a   IE 4   HTML n/a
ID="elementIdentifier"Optional
 

A unique identifier that distinguishes this element from all the rest in the document. Can be used to associate a single element with a style rule naming this attribute value as an ID selector. An element can have an ID assigned for uniqueness as well as a class for inclusion within a group. See .

If you assign an ID attribute and not a NAME attribute, the value of the ID attribute can be used as the EMBED element's name in Internet Explorer script reference forms that use the element name (document.all.embedName).

 
Example
<EMBED ID="jazzSound" SRC="jazz.aif" HEIGHT=15 WIDTH=25></EMBED>
 
Value
Case-sensitive identifier.
 
Default None.
 
Object Model Reference
IE [window.]document.embeds[i].id
[window.]document.elementID.id
NAMENN 2   IE 3   HTML n/a
NAME="elementIdentifier"Optional
 

If you are scripting a plugin (especially in Navigator via LiveConnect), it is usually more convenient to create a reference to the embedded element by using a unique name you assign to the item. Thus, if you edit the page and move or delete multiple EMBED elements on the page, you do not have to worry about adjusting index values to array-style references (document.embeds[i]).

 
Example
<EMBED NAME="jukebox" SRC="jazz.aif" HEIGHT=15 WIDTH=25></EMBED>
 
Value
Case-sensitive identifier.
 
Default None.
 
Object Model Reference
IE [window.]document.embeds[i].name
[window.]document.elementID.name
PALETTENN 2   IE 4   HTML n/a
PALETTE="foreground" | "background"Optional
 

The Netscape documentation says that the PALETTE attribute lets you apply the background or foreground palette to the plugin invoked by the EMBED element, but only in the Windows environment.

 
Example
<EMBED NAME="jukebox" SRC="jazz.aif" HEIGHT=150 WIDTH=250 PALETTE="foreground">
</EMBED>
 
Value
Case-insensitive constant: foreground | background
 
Default background
 
Object Model Reference
IE [window.]document.embeds[i].palette
[window.]document.elementID.palette
PLUGINSPAGENN 2   IE n/a   HTML n/a
PLUGINSPAGE="URL"Optional
 

If the MIME type of the data file assigned to the EMBED element's SRC attribute is not supported by an existing plugin or helper application in the browser, the PLUGINSPAGE attribute is intended to provide a URL for downloading and installing the necessary plugin. If you omit this attribute, Navigator presents a generic link to Netscape's own resource listing of plugin vendors.

 
Example
<EMBED NAME="jukebox" SRC="jazz.aif" HEIGHT=150 WIDTH=250 
PLUGINSPAGE="http://www.giantco.com/plugin/install/index.html">
</EMBED>
 
Value
Any valid URL.
 
Default None.
PLUGINURLNN 4   IE n/a   HTML n/a
PLUGINURL="URL"Optional
 

Navigator 4 introduces the power (a feature called Smart Update) to allow somewhat automatic installation of browser components. If a user does not have the necessary plugin installed for your EMBED element's data type, the PLUGINURL can point to a Java Archive (JAR) file that contains the plugin and digitally signed objects to satisfy security issues surrounding automatic installation (via Netscape's Java Installation Manager). A JAR file is both digitally signed and compressed (very much along the lines of a .zip file), and is created with the help of Netscape's JAR Packager tool.

You can include both the PLUGINSPAGE and PLUGINURL attributes in an EMBED element's tag to handle the appropriate browser version. Navigator 2 and 3 respond to the PLUGINSPAGE attribute, whereas Navigator 4 gives precedence to the PLUGINURL attribute when it is present.

 
Example
<EMBED NAME="jukebox" SRC="jazz.aif" HEIGHT=150 WIDTH=250 
PLUGINURL="http://www.giantco.com/plugin/install.jar">
</EMBED>
 
Value
Any valid URL to a JAR file.
 
Default None.
SRCNN 2   IE 3   HTML n/a
SRC="URL"Optional
 

The SRC attribute is a URL to a file containing data that is played through the plugin. For most uses of the EMBED element, this attribute is required, but there are some circumstances in which it may not be necessary (see the TYPE attribute). Browsers typically use the filename extension to determine which plugin to load (based on browser preferences settings for plugins and helper applications).

 
Example
<EMBED NAME="babyClip" SRC="Ugachaka.avi" HEIGHT=150 WIDTH=250></EMBED>
 
Value
A complete or relative URL.
 
Default None.
 
Object Model Reference
IE [window.]document.embeds[i].src
[window.]document.elementID.src
TYPENN 2   IE n/a   HTML n/a
TYPE="MIMEtype"Optional
 

Navigator anticipated the potential of a plugin not requiring any outside data file. Instead, such a plugin would more closely resemble an applet. If such a plugin is to be put into your document, you still use the EMBED element but specify just the MIME type instead of the data file URL (in the SRC attribute). This assumes, of course, that the MIME type is of such a special nature that only one possible plugin would be mapped to that MIME type in the browser settings. Either the SRC or TYPE attribute must be present in a Navigator EMBED element tag.

 
Example
<EMBED TYPE="application/x-frobnitz" HEIGHT=150 WIDTH=250></EMBED>
 
Value
Any valid MIME type name as a quoted string, including the type and subtype portions delimited by a forward slash.
 
Default None.
UNITSNN 2   IE 3   HTML n/a
UNITS="measurementUnitType"Optional
 

The UNITS attribute is supposed to dictate the kind of measurement units used for the element's HEIGHT and WIDTH attribute values. Both Navigator 4 and Internet Explorer 4 appear to treat the measurements in pixels, regardless of this attribute's setting.

 
Example
<EMBED SRC="jazz.aif" HEIGHT=150 WIDTH=250 UNITS="en"></EMBED>
 
Value
Not only does this attribute not appear to influence the rendering of an EMBED element, but Navigator 4 and Internet Explorer 4 disagree on the precise spelling and available units for values. Navigator 4 specifies choices of pixels or en; Internet Explorer goes with px or em.
 
Default pixels (or px).
 
Object Model Reference
IE [window.]document.embeds[i].units
[window.]document.elementID.units
Hosted by uCoz