HTML DOM Embed src Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

Embed src Property

❮ Embed Object

Example

Return the URL of an embedded file:

var x = document.getElementById("myEmbed").src;
Try it Yourself »

Definition and Usage

The src property sets or returns the value of the src attribute in an embed element.

The src attribute specifies the address (URL) of the external file to embed.


Browser Support

Property
src Yes Yes Yes Yes Yes

Syntax

Return the src property:

embedObject.src

Set the src property:

embedObject.src = URL

Property Values

Value Description
URL Specifies the address (URL) of the external file to embed.

Possible values:
  • An absolute URL - points to another web site (like src="http://www.example.com/hello.swf")
  • A relative URL - points to a file within a web site (like src="hello.swf")

Technical Details

Return Value: A String, representing the URL of the embedded file. Returns the entire URL, including the protocol (like http://)

Related Pages

HTML reference: HTML <embed> src attribute


❮ Embed Object