Easy Tutorial
❮ Jsref Regexp Digit Non Prop Style Textalign ❯

Video src Attribute

Video Object

Example

Change the video URL:

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

Definition and Usage

The src attribute sets or returns the value of the src attribute of a video.

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


Browser Support

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

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


Syntax

Return the src attribute:

Set the src attribute:

Attribute Values

Value Description
URL Specifies the URL of the video source. Possible values: absolute URL - points to another website (e.g., src="http://example.com/movie.ogg")<br> relative URL - points to a file within the website (e.g., src="movie.ogg")

Technical Details

| Return Value: | A string, representing the URL of the video file. Returns the actual URL, including the protocol part (e.g., http://) | | --- | --- |


More Examples

Example

Get the video URL:

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

Related Pages

HTML Reference: HTML <video> src Attribute


❮ Jsref Regexp Digit Non Prop Style Textalign ❯