You are here: Reference > JavaScript > client-side > HTML DOM > objects > nodes and tags > embed

embed object

Browser support:
Specifies an object to be embedded.
The embed tag is a non-standard element in HTML, but it is supported by all commonly used browsers. The embed tag can have additional properties depending on the embedded application.
  • For example, if the embedded application is Adobe Flash Player, you can set the quality of display with the quality attribute. See Example 1 for details.
  • If the embedded application is Windows Media Player, the value of the autostart attribute indicates whether playback should start automatically upon loading. You can modify the visual appearance of the control with the showcontrols, showdisplay and showstatusbar attributes. See Example 3 for details.

Syntax:

Methods that return the object:
document.createElement ("embed")
embeds.item (nameOrIndex [, subIndex])
embeds.namedItem (name)
The base interface, through which you can add new functionalities to the embed object, is the HTMLEmbedElement interface.
If you want to see the HTML objects by categories, please visit this page.
HTML page for this element: embed

Possible members:

Properties
Methods
Events
Style properties
accessKey
Sets or retrieves an access key to an element.
align
8
Sets or retrieves the object's position with respect to the surrounding text.
attributes
Represents a collection of attribute nodes that belong to an element.
baseURI
10
Returns the base URL for the object.
behaviorUrns
Represents a collection of the Uniform Resource Names for all behaviors attached to an element.
canHaveChildren
Retrieves a Boolean value that indicates whether the element can contain child elements.
canHaveHTML
Retrieves a Boolean value that indicates whether the element can contain HTML formatted text.
className
Sets or retrieves the style class or classes that belong to the element.
clientHeight
Returns the height of the visible area for an object, in pixels. The value contains the height with the padding, but it does not include the scrollBar, border, and the margin.
clientLeft
Returns the width of the left border in pixels.
clientTop
Returns the height of the top border in pixels.
clientWidth
Returns the width of the visible area for an object, in pixels. The value contains the width with the padding, but does not include the scrollBar, border, and the margin.
contentEditable
3
Sets or retrieves whether the contents of the object are editable.
currentStyle
Represents the computed style settings for an element.
dir
Sets or retrieves the text direction as related to the lang property.
disabled
Sets or retrieves the state of an object for user interaction.
draggable
3.55
Sets or retrieves whether an element is draggable.
filters
Represents a collection of all filter objects applied to an element.
height
Specifies or returns the height of an element.
hidden
Specifies or returns a string value that indicates whether an embed object is visible.
hideFocus
Specifies or returns whether a dotted rectangle (focus rectangle) is drawn around an object while it has focus.
id
Sets or retrieves a unique identifier for the object.
isContentEditable
Returns a Boolean value that indicates whether the contents of the object are editable by the user.
isDisabled
Returns a Boolean value that indicates whether the object is disabled.
isMultiLine
Returns a Boolean value that indicates whether the contents of an element can be multiline or not.
isTextEdit
Returns a Boolean value that indicates whether the createTextRange method can be used for the element.
lang
Specifies or returns the language of the element.
language
Sets or retrieves the scripting language for the current element. Use it only for the script element.
localName
9
Returns the local part of the qualified name of the current node.
loop
Sets or retrieves the type of repetition of the embedded media.
name
Sets or retrieves the name of an element.
namespaceURI
93.6
Sets or returns the namespace URI of the current node.
nextElementSibling
93.5
Returns a reference to the next child element of the current element's parent.
nextSibling
Returns a reference to the next child of the current element's parent.
nodeName
Returns the name of the current node.
nodeType
Returns an integer that indicates the type of the node.
nodeValue
Sets or returns the value of the current node.
offsetHeight
Returns the height of the visible area for an object, in pixels. The value contains the height with the padding, scrollBar, and the border, but does not include the margin.
offsetLeft
Returns the left position of an object relative to the left side of its offsetParent element, in pixels.
offsetParent
Returns a reference to the closest ancestor element in the DOM hierarchy from which the position of the current element is calculated.
offsetTop
Returns the top position of the object relative to the top side of its offsetParent element, in pixels.
offsetWidth
Returns the width of the visible area for an object, in pixels. The value contains the width with the padding, scrollBar, and the border, but does not include the margin.
outerHTML
Sets or retrieves the outer HTML content (the source code including the opening and closing tags) of an element.
outerText
Sets or returns the text content of an element including the text content of its descendants.
ownerDocument
Returns the document object that contains the current node.
palette
Returns the palette used for the embedded document.
parentElement
Returns the parent element of the object in the DOM hierarchy.
parentNode
Returns the parent element of the current node in the DOM hierarchy.
parentTextEdit
Returns the closest ancestor element of the current element in the DOM hierarchy that can be used to create a TextRange object.
pluginspage
Sets or retrieves the URL for installing a plug-in. If an embedded plug-in is not accessible on the client site, the URL can be used by the browser to download and install the required component.
previousElementSibling
93.5
Returns a reference to the previous child element of the current element's parent.
previousSibling
Returns a reference to the previous node of the current element's parent.
readyState
Returns a string value that represents the state of the object.
runtimeStyle
Represents the overridden style settings for an element.
scopeName
Retrieves the local name of the namespace declared for the current element.
sourceIndex
Returns the position of the current object in the all collection of the document.
src
Sets or retrieves the location of an associated file for an object.
style
Represents the inline style settings for an element or a CSS rule.
tabIndex
Specifies or returns the tabbing order for keyboard navigation using the TAB key.
tagName
Returns the tag name of the current element.
tagUrn
Sets or retrieves the Uniform Resource Name (URN) of the namespace declared for the current element.
title
Specifies or returns a tooltip for an element.
type
Specifies or returns the content type (MIME type) of the object or the linked object.
uniqueID
Returns the unique identifier generated by the browser for the object.
units
Specifies or returns the measurement system used for the height and width properties of an embed object.
unselectable
Sets or retrieves whether the selection process can start in an element's content.
width
Specifies or returns the default width of the element.

Example HTML code 1:

This example illustrates the use of the embed element with Macromedia Flash Player:
<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" 
    width="300px" height="200px" src="flash.swf" quality="high" />
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the embed element with Macromedia Flash Player.
It clearly focuses on cross-browser support only, and it isn’t standards-compliant, but there isn't any standards-compliant cross-browser way to embed a Flash application into a document with Flash Player detection.
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="120" 
        codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
        standby="Loading flash movie">
    <param name="movie" value="flash.swf" />
    <!-- Optional params -->
    <param name="play" value="true" />
    <param name="loop" value="true" />
    <param name="quality" value="high" />
    <!-- END Optional -->
    <embed src="flash.swf" width="300" height="120" play="true" 
        loop="true" quality="high" 
        pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" /> 
</object>
Did you find this example helpful? yes no

Example HTML code 3:

This example illustrates the use of the embed element with Windows Media Player:
<embed type="application/x-mplayer2" src="testVideo.wmv" 
        width="320px" height="286px" autostart="true" showcontrols="1" 
        showstatusbar="0" showdisplay="0" />
Did you find this example helpful? yes no

Example HTML code 4:

This example shows how to get the codeBase of an applet element in JavaScript:
<head>
    <script type="text/javascript">
        function GetURL () {
            var embed = document.getElementById ("myEmbed");
            alert (embed.src);
        }
    </script>
</head>
<body>
    <embed id="myEmbed" type="application/x-mplayer2" 
            src="testVideo.wmv" 
            width="320px" height="286px" autostart="true" showcontrols="1" 
            showstatusbar="0" showdisplay="0" />
    <br /><br />
    <button onclick="GetURL ();">Get the URL of the video file</button>
</body>
Did you find this example helpful? yes no

Related pages:

External links:

User Contributed Comments

Post Content

Post Content