Embed srcAttribute

Embed 对象参考手册Embed Object

Examples

Returns the URL of the embedded file:

var x = document.getElementById("myEmbed").src;
xThe output is:
http://www.w3cschool.cc/jsref/helloworld.swf

Try it Yourself »

Definition and Usage

The src attribute is used to set or return the value of the src attribute of the embed element.

The src attribute describes the external address (URL) of the embedded file.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the src attribute.


Syntax

Return the src attribute:

embedObject.src

Set the src attribute:

embedObject.src=URL

Attribute Values

Value Description
URL Describes the external address (URL) of the embedded file.

Possible values:
  • Absolute URL address - points to another site (e.g., src="http://www.example.com/hello.swf")
  • Relative URL address - points to a site-internal address (e.g., src="hello.swf.html")

Technical Details

Return value: String, representing the URL of the embedded file. Returns the absolute URL, including the protocol part (http://).


Related Pages

HTML Reference Manual:HTML <embed> src Attribute


Embed 对象参考手册Embed Object Other Extensions