Latest web development tutorials
 

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

Internet Explorer Firefox Opera Google Chrome Safari

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

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


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