YouTip LogoYouTip

Prop Track Default

HTML DOM Track default Property

HTML DOM Track default Property

Track Object Reference Track Object

Example

Get the default state of the track:

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

x output will be:

false

Definition and Usage

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

This property reflects the <track> default attribute.

If the default attribute is used, it specifies that the track is to be enabled if no other track is more suitable for the user (e.g. based on user preferences).

Note: There can only be one <track> element with the default attribute per media element.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The default property is supported in Internet Explorer, Opera, and Chrome.

Note: The default property is not supported in Firefox, Safari, or Internet Explorer 9 and earlier.


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 enabled by default.
  • false - Default. The track is disabled.

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 Reference Track Object

← Prop Progress ValueProp Progress Position β†’