Embed src attribute

Definition and usage

src Sets or returns the value of the src attribute in the embed element.

embed src attribute Specifies the address (URL) of the external file to be embedded.

See also:

HTML Reference Manual:HTML <embed> Tag

Example

Returns the URL of the embedded file:

var x = document.getElementById("myEmbed").src;

Try it yourself

Syntax

Return the src attribute:

embedObject.src

Set the src attribute:

embedObject.src = URL

Attribute value

Value Description
URL

Specifies the address (URL) of the external file to be embedded.

Possible values:

  • Absolute URL - Points to another website (such as src="http://www.example.com/hello.swf")
  • Relative URL - Points to a file within the website (such as src="hello.swf").

Technical Details

Return Value: A string value representing the URL of the embedded file. Returns the entire URL, including the protocol (such as http://).

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Related Pages

HTML Reference Manual:HTML <embed> src Attribute