Track src Property
Example
Get the URL of the track file:
var x = document.getElementById("myTrack").src;
x Output value:
http://www.w3cschool.cc/jsref/subtitles_en.vtt
Definition and Usage
The src property is used to set or return the value of the track's src attribute.
The src property describes the URL of the track file.
Browser support





Internet Explorer, Opera, and Chrome browsers support the src property.
**Note:** Firefox, Safari, or Internet Explorer 9 and earlier versions do not support the src property.
Syntax
Return the src attribute:
trackObject
.src
Set the src attribute:
trackObject
.src=
URL
Attribute values
| Value | Description |
|---|---|
| URL | Describes the URL of the track file |
Technical Details
| Return Value: | A string representing the URL of the track text, returning the actual URL including the protocol part (e.g. http://) |
|---|
More examples
Example
Modify the URL of the track file:
document.getElementById("myTrack").src="subtitles_no.vtt";
Related pages
HTML Reference Manual: HTML
The Track object