<EMBED> | NN 2 IE 3 HTML n/a | ||||||||||||||
<EMBED>...</EMBED> | HTML End Tag: Optional/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 never became a part of the HTML standard vocabulary. The HTML 4 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 later and Internet Explorer 4 and later 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 for IE/Windows, IE/Mac, and Navigator 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 | |||||||||||||||
[window.]document.embeds[elementName] [window.]document.getElementById(elementID) |
|||||||||||||||
Element-Specific Attributes | |||||||||||||||
|
|||||||||||||||
Element-Specific Event Handler Attributes | |||||||||||||||
None. |
align | NN 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. Typically, align attributes are deprecated in HTML 4 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: |
|
Default | |
bottom |
|
Object Model Reference | |
[window.]document.embeds[elementName].align [window.]document.getElementById(elementID).align |
alt | NN 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. |
height, width | NN 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. |
|
Default | |
None. |
|
Object Model Reference | |
[window.]document.embeds[i].height [window.]document.getElementById(elementID).height [window.]document.embeds[i].width [window.]document.getElementById(elementID).width |
id | NN 4 IE 4 HTML 4 |
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 Chapter 3. IE 4 and later and Netscape 6 allow id attributes for nonrenderable elements, but if your code requires validation, be aware that the W3C HTML 4 and XHTML DTDs do not. Because all W3C DOM elements have an id property, it is natural to assign an id attribute to non-renderable elements if scripts must reference those elements. Or, your scripts may use other ways (e.g., the array returned by document.getElementsByTagName( )) to reference such elements. Assign identifiers to id attributes in order to duplicate values previously only assigned to name attributes in elements that feature the name attribute. Current browser form controls still require name attributes for name/value pairs to be submitted with the form, and a elements acting as anchors still need name attributes. Be sure to assign an identifier to the id attribute of any element you intend to reference by script. |
|
Example | |
<H2 id="sect3Head">Section Three</H2> |
|
Value | |
Case-sensitive identifier. |
|
Default | |
None. |
|
Object Model Reference | |
[window.]document.getElementById(elementID).id
|
lang | NN 3 IE 4 HTML 4 |
lang="languageCode" | Optional |
The language being used for the element's attribute values and content. A browser can use this information to assist in proper rendering of content with respect to details such as treatment of ligatures (when supported by a particular font or required by a written language), quotation marks, and hyphenation. Other applications and search engines might use this information to aid the selection of spell-checking dictionaries and the creation of indices. |
|
Example | |
<SPAN lang="de">Deutsche Bundesbahn</SPAN> |
|
Value | |
Case-insensitive language code. |
|
Default | |
Browser default. |
|
Object Model Reference | |
[window.]document.getElementById(elementID).lang
|
name | NN 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[embedName]). |
|
Example | |
<EMBED name="jukebox" id="jukebox" src="jazz.aif" height="15" width="25"></EMBED> |
|
Value | |
Case-sensitive identifier. |
|
Default | |
None. |
|
Object Model Reference | |
[window.]document.embeds[i].name
[window.]document.getElementById(elementID).name
|
pluginspage | NN <6 IE 4 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 4 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. |
pluginurl | NN |4| IE n/a HTML n/a |
pluginurl="URL" | Optional |
Navigator 4 (only) introduced 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. |
src | NN 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 | |
[window.]document.embeds[i].src
[window.]document.getElementById(elementID).src
|
type | NN 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 src="hooha.fbz" 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. A catalog of registered MIME types is available from ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/. |
|
Default | |
None. |
units | NN <6 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 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 | |
[window.]document.embeds[i].units
[window.]document.getElementById(elementID).units
|
width | |
See height. |