The <EMBED>
element allows authors to embed objects directly into an HTML page
The basic syntax is:
<EMBED SRC="_URL_">
<NOEMBED>Alternative content</NOEMBED>
</EMBED>
where "_URL_" represents the URL of the object that is to be embedded. See below for a description of the <NOEMBED>
element.
The <EMBED>
element will allow you to embed documents, or objects of any type. Your user only needs to have an application which can view the data installed correctly on their machine, or have a plug-in (for Netscape and Internet Explorer) that can manipulate the embedded file format.
The <EMBED>
element can be used more or less the same as the <IMG>
element and so accepts typical image embedding attributes such as ALIGN, ALT, BORDER, WIDTH, HEIGHT, HSPACE, VSPACE and NAME (for referencing the embedded object in a script function). Note that multiple <EMBED>
elements can be grouped together with the same NAME
attribute value, to provide multiple separate controls for a single embedded sound file).
Plug-ins
Netscape plug-ins make use of the <EMBED>
element. Essentially, plug-ins are dynamic code modules which are associated with a MIME data type that the Netscape client has no native support for. When Netscape encounters an unknown data type from a server, it will search for a plug-in that is associated with that MIME type and load it, enabling viewing/transforming of the data object. There are many attributes to the <EMBED>
element that are plug-in specific (for these, see the relevant plug-in documentation), but as well as the attributes above, the <EMBED>
element accepts the following attributes as standard across all embedded data types.
CLASS="Style Sheet class"
The CLASS
attribute is used to specify the <EMBED>
element as using a particular style sheet class. See the Style Sheets topic for details.
HIDDEN="true|false"
Setting this attribute specified whether the plug-in is visible or not. Some plug-ins (like the LiveAudio plug-in) can control the embedded data type without being visible. The default value is "false", which causes the plug-in controls to be displayed.
ID="Unique identifier"
The ID
attribute can be used to either reference a unique style sheet identifier, or to provide a unique name for the <EMBED>
element for scripting purposes. Any <EMBED>
element with an ID
attribute can be directly manipulated in script by referencing its ID
attribute, rather than working through the All collection to determine the element. See the Scripting introduction topic for more information.
PALETTE="foreground|background"
For users browsing in 256 colours, some embedded objects could cause what is known as 'palette flash', where palette differences between the embedded object and the browser/system cause the incorrect colours to be displayed. To avoid this, embedded objects can have their palettes expressly defined as either foreground
or background
(the default). 'Foreground' causes the embedded object to use the foreground palette and 'background' forces it to use the background palette (the colours not reserved by the browser/system). Note that this attribute only has effect on the Windows platforms.
PLUGINSPACE="_URL_"
If the user doesn't have a plug-in installed to handle the defined object data type (determined from the SRC
attribute, or TYPE
attribute value), then it is possible to guide the user to a different URL (the value of the PLUGINSPACE
attribute) to provide instructions on installing the necessary plug-in module. Generally, this should be the plug-in vendors installation instructions document.
STYLE="Styling"
As well as using previously defined style sheet settings, the <EMBED>
element can have in-line stylings attached to it. See the Style Sheets topic for details.
TITLE="Informational ToolTip"
The Internet Explorer 4.0 (and above) specific TITLE
attribute is used for informational purposes. If present, the value of the TITLE
attribute is presented as a ToolTip when the users mouse hovers over the <EMBED>
section, when the embedded object doesn't provide ToolTips of its own..
TYPE="MIME type"
Either this, or the SRC
attribute is necessary when inserting embedded objects into HTML documents, in order for Netscape to be able to determining a suitable plug-in module to use to handle the data type. The TYPE
attribute accepts any valid MIME type, to describe the type of object being inserted.
For more information about plug-ins, see the Netscape web site. http://home.netscape.com/. Lots of plug-in modules are available, the additional attributes for which are beyond the scope of this document. The documentation with the plug-in should be consulted for useable HTML element attributes.
NOTE : Microsoft's Internet Explorer (from version 3.0 beta 2) fully supports Netscape plug-ins. When Internet Explorer loads a page designed to use a (Netscape) plug-in module, it will use either the correct plug-in, or a pre-installed ActiveX control to display the content as authored. Microsoft recently released the ActiveVRML and ActiveMovie add-ons for Internet Explorer which can handle VRML worlds, AVI, QuickTime, MPEG video/audio, WAV, Sun AU and AIFF sound files respectively, either using the respective ActiveX <OBJECT>
code, or <EMBED>
code as used by popular Netscape plug-ins.
Examples
Below is the code used to embed a MIDI file. The displayed control panel (displayed by default) could be used to play the sound file.
<EMBED SRC="clouds.mid" WIDTH="145" HEIGHT="61">
NOTE : Internet Explorer will use the Netscape 'LiveAudio' plug-in (if Netscape 3.0 is installed, the LiveAudio plug-in distributed with Netscape Communicator will not function inside Internet Explorer)), or any installed ActiveX control for manipulation of the above MIDI file)
Below is the code used to embed a VRML world. The Live3D (or whatever ActiveX control is installed to handle VRML files) control panel could be used to manipulate it.
<EMBED SRC="../Media_Embedding/example.wrl" WIDTH="200" HEIGHT="150">
NOTE : Internet Explorer will use the ActiveVRML add-in (if installed), or whatever Netscape plug-in is used within Netscape to handle the above Virtual world. It will display the 'broken object' symbol if no suitable plug-in, or ActiveX control is installed.
<NOEMBED>
Much like the <NOFRAMES>
element, <NOEMBED>
can be used to provide alternative content for older browsers that don't understand the <EMBED>
element. Older browsers will ignore the <EMBED>
element (and the <NOEMBED>
element to be exact), but will render any HTML content they find in between the <EMBED>
and </EMBED>
elements. Browsers that do understand the <EMBED>
element will not render any content between the <EMBED>
and </EMBED>
elements. For example :
<EMBED SRC="MyWorld.wrl" WIDTH="200" HEIGHT="150">
<NOEMBED>You need Netscape or Internet Explorer to see this</NOEMBED>
</EMBED>
Netscape (from version 2.0) and Internet Explorer (from version 3.0) would embed the VRML world "MyWorld.wrl" (providing there is a suitable plug-in/ActiveX control installed), while older browsers would display the message 'You need Netscape or Internet Explorer to see this'
Every <EMBED>
element in a document is an object that can be manipulated through scripting. Note that most of the scripting of the <EMBED>
element/object is only supported by Internet Explorer 4.0 in its Dynamic HTML object model. Netscape supports some <EMBED>
related scripting through the Plug-ins array and Embeds array, but that supported by Internet Explorer is far more versatile.
<EMBED...>
Properties
The <EMBED...>
element/object supports all of the standard Dynamic HTML properties (i.e. className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName and title). Details of these can be found in the standard Dynamic HTML properties topics.
The <EMBED>
element also supports the following properties:
align, alt, border, hidden, height, hspace, vspace, palette, pluginspace and type
They all directly reflect their attribute settings (if any). See the particular attribute for details.
<EMBED...>
Methods
The <EMBED...>
element/object supports all of the standard Dynamic HTML methods (i.e. click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView and setAttribute). Details of these can be found in the standard Dynamic HTML Methods topics.
Also, the <EMBED>
element supports the following methods:
blur
The blur
method can be used to force the embedded object to lose the users focus. This then fires the onblur
event (see below).
focus
The focus
method can be used to force the embedded object to gain the users focus. This then fires the onfocus
event (see below).
<EMBED...>
Events
The <EMBED...>
element/object supports all of the standard Dynamic HTML events (i.e. onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup and onselectstart). Details of these can be found in the standard Dynamic HTML events topics.
Also, the <EMBED>
element supports the following events:
onblur
onblur
is fired whenever the users focus moves away from the embedded object (either by them clicking on another part of the document, or by 'tabbing' away from the contents of the <EMBED>
element, or by using the blur
method (see above).
onfocus
The onfocus
event is fired whenever the user passes the focus to the embedded object - by clicking on it, tabbing to it, or by a script function using the focus
method (see above).
© 1995-1998, Stephen Le Hunte
Comments:
Questions:
i saw your website,its really amazing,I am facing one problem when i am embedding .wmv file to our project.Before displaying the movie file.the browser(IE) is becoming in black color for a second before its start getting displaying ht movie file.i dont know the reason.whether we have to specify any proerty in order to avoid this.i am waiting for ur response.
A.suresh
See also: