Latest web development tutorials

HTML DOM Video src attribute

Video Object Reference Video Object

Examples

Changing the URL of the video:

document.getElementById ( "myVideo") src = "mov_bbb.ogg".;

try it"

Definition and Usage

src property sets or returns the value of the src attribute of the video.

src attribute describes the location of the video file (URL).


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the src attribute, but not all browsers support the specified file format.

Note: Internet Explorer 8 and earlier versions of IE do not support the <video> element.


grammar

Back src attribute:

videoObject .src

Setting the src attribute:

videoObject .src = URL

Property Value

value description
URL

It specifies the URL of the video sources.

Possible values:

  • Absolute URL - points to another web site (like src = "http://example.com/movie.ogg")
  • Relative URL - points to a file within the site (such as src = "movie.ogg")

technical details

return value: String that represents the URL of the video file. Back entity URL, including the protocol part (such as http: //)


More examples

Examples

Get video URL:

var x = document.getElementById ( "myVideo") src.;
x The output is:
http://www.w3cschool.cc/jsref/movie.ogg

try it"


Related Pages

HTML Reference Manual: HTML <Video> the src attribute


Video Object Reference Video Object