Track srcAttribute

Track 对象参考手册Track Object

Example

Get the URL address of the track file:

var x = document.getElementById("myTrack").src;

xThe output value is:

http://www.w3cschool.cc/jsref/subtitles_en.vtt


Definition and Usage

The src attribute is used to set or return the value of the track's src attribute.

The src attribute describes the URL address of the track file.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer, Opera, and Chrome browsers support the src attribute.

Note:Firefox, Safari or Internet Explorer 9 and earlier IE versions do not support the src attribute.



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 absolute URL, including the protocol portion (such as http://).


More Examples

Example

Modify the URL of the track file:

document.getElementById("myTrack").src="subtitles_no.vtt.html";



Related Pages

HTML Reference Manual:HTML <track> src Attribute


Track 对象参考手册Track Object Other Extensions