Track default attribute

Definition and Usage

default Sets or returns the default state of the track.

This attribute reflects the <track> default attribute.

When this attribute is set, it specifies that the track is enabled if the user's preference does not indicate that another track is more suitable.

Note:Each media element cannot have multiple track elements with the default attribute.

See also:

HTML Reference Manual:HTML <track> default Attribute

Instance

Example 1

Get the default state of the track:

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

The result of x may be:

false

Example 2

Set the default state of the track:

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

Syntax

Return default attribute:

trackObject.default

Set default attribute:

trackObject.default = true|false

Attribute value

Value Description
true|false

Specifies the default state of the track.

  • true - The track will be enabled if the user's preference does not indicate that another track is more suitable
  • false - Default. The track will not be enabled if the user's preference does not indicate that another track is more suitable

Technical Details

Return Value: Boolean value indicating the default state of the track.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported 10.0 Not Supported Not Supported Supported