Track defaultProperty

Track 对象参考手册Track Object

Examples

Get the default state of the track:

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

xThe output result is:

false


Definition and Usage

The default property is used to set or return the default state of the track.

This property reflects the <track> default attribute.

If the default attribute is used, it specifies that the track should be used if the user does not select another track.

Note:There cannot be more than one track element. The track elements of each media element can have only one default attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer, Opera, and Chrome browsers support the srclang attribute.

Note:Firefox, Safari, or Internet Explorer 9 and earlier IE versions do not support the srclang attribute.


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

Technical Details

Return Value: A Boolean value, indicating 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 Manual:HTML <track> default Attribute


Track 对象参考手册Track Object Other Extensions