Skip to content
Related Articles

Related Articles

HTML | DOM Track src property
  • Last Updated : 10 Apr, 2019
GeeksforGeeks - Summer Carnival Banner

The DOM track src property is used to set or return the value of the src attribute which shows the URL of the text track.


  • It is used to return the default property.
  • It is also used to set the default property.
    trackObject.src = URL


  • URL: It is used to specify the URL of the text track.

Return Value: It returns the URL(including protocol) of the track in the form of string.


        body {
            text-align: center;
        h1 {
            color: green;
      Track src Property
    <video width="100"
        <track src=
            <source id="myTrack"
      Click the button to get
      the source of the track.
    <button onclick="myFunction()">
        Get URL
    <p id="gfg"></p>
    <!-- Script to get the URL property -->
        function myFunction() {
            var x = document.getElementById(
              "gfg").innerHTML = myTrack.src;

Before clicking on the button:

After clicking on the button:

Supported Browsers:

  • Google Chrome
  • Internet Explorer 10.0+
  • Opera


My Personal Notes arrow_drop_up
Recommended Articles
Page :