Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Track src Property

Track src Property

Track Object Reference The Track object

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 ExplorerFirefoxOperaGoogle ChromeSafari

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 src property


Track Object Reference The Track object