Example
Get the URL of the track file:
var x = document.getElementById("myTrack").src;
The result of x could be:
http://www.w3ii.com/jsref/subtitles_en.vtt
Definition and Usage
The src property sets or returns the value of the src attribute of the track.
The src attribute specifies the URL of the track file.
Browser Support
The src property is supported Internet Explorer, Opera, and Chrome.
Note: The src property is not supported in Firefox, Safari or Internet Explorer 9 and earlier versions.
Syntax
Return the src property:
trackObject.src
Set the src property:
trackObject.src=URL
Property Values
Value | Description |
---|---|
URL | Specifies the URL of the track file |
Technical Details
Return Value: | A String, representing the URL of the track file. Returns the entire URL, including the protocol (like http://) |
---|
More Examples
Example
Change the URL of the track file:
document.getElementById("myTrack").src = "subtitles_no.vtt";
Related Pages
HTML reference: HTML <track> src attribute
< Track Object