THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Embed src Property

Embed Object Reference Embed Object

Example

Return the URL of an embedded file:

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

The result of x will be:

http://www.w3schools.com/jsref/helloworld.swf
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 Reference Embed Object