Video src property
Example
Change the URL of the video:
document.getElementById("myVideo").src = "mov_bbb.ogg";
Try it »
Definition and Usage
The src property sets or returns the value of the video's src attribute.
The src property describes the location (URL) of the video file.
Browser support





All major browsers support the src property, but not all browsers support the specified file format.
Note: Internet Explorer 8 and earlier IE versions do not support
Syntax
Return the src attribute:
videoObject
.src
Set the src attribute:
videoObject
.src=
URL
Attribute values
| Value | Description |
|---|---|
| URL |
Specifies the URL of the video source. Possible values: |
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 URL of the video:
var x = document.getElementById("myVideo").src;
x
The output is:
https://www.example.com/jsref/movie.ogg
Try it »
Related pages
HTML Reference Manual: HTML
The Video object