YouTip LogoYouTip

Prop Track Src

HTML DOM Track src Property

HTML DOM Track src Property

-- Learning is not just about technology, but also about dreams!

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

HTML DOM Time Object

HTML DOM Video Object

Track src Property

Track Object Reference Track Object

Example

Get the URL of the track file:

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

x output value is:

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

Definition and Usage

The src property is used to set or return the src attribute of a track.

The src property describes the URL of the track file.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer, Opera, and Chrome support the src property.

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


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 text. Returns the full URL, including the protocol part (e.g., 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 Reference Track Object

HTML DOM Time Object

HTML DOM Video Object

iFlytek Xingchen Coding Plan includes free model call quotas, DeepSeek, GLM, Kimi, MiniMax, one-stop experience and deployment platform. Configuration Guide Β₯3.9/month Subscribe Now

Click to Share Notes

Cancel

← Prop Track SrclangProp Track Kind β†’