THE WORLD'S LARGEST WEB DEVELOPER SITE

Track default Property

❮ Track Object

Example

Get the default state of the track:

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

The result of x could be:

false


Definition and Usage

The default property sets or returns the default state of the track.

This property reflects the <track> default attribute.

When present, it specifies that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate.

Note: There must not be more than one track element with a default attribute per media element.


Browser Support

Property
default Yes 10.0 Not supported Not supported Yes


Syntax

Return the default property:

trackObject.default

Set the default property:

trackObject.default = true|false

Property Values

Value Description
true|false Specifies the default state of the track
  • true - The track is to be enabled if the user's preferences do not indicate that another track would be more appropriate
  • false - Default. The track is NOT to be enabled if the user's preferences do not indicate that another track would be more appropriate

Technical Details

Return Value: A Boolean, representing the default state of the track

More Examples

Example

Set the default state of the track:

document.getElementById("myTrack").default = true;


Related Pages

HTML reference: HTML <track> default attribute


❮ Track Object