The HTML default attribute
The HTML default attribute turns a <track> on unless the viewer's settings pick another. It is a boolean attribute, and a media element may have only one default among its subtitles and captions tracks.
Overview
The default attribute tells the browser which text track to enable when nothing else decides. It is a boolean attribute of the <track> element, and the HTML Standard defines it as enabling the track unless the user's preferences point to a more appropriate one.
Without it, a track stays disabled unless the viewer's preferences select it. A disabled track is not even fetched, so captions stay off until the viewer picks them from the menu or a script changes the track's mode. With default on a subtitles or captions track, automatic track selection sets that track to showing, as long as no track in that group is already showing and the viewer's preferences do not pick another one.
The limits depend on the kind. One default is allowed among subtitles and captions together, one among descriptions and one among chapters, while any number of metadata tracks may carry it. A default chapters or metadata track is set to hidden rather than showing, so its cues load for scripts without being drawn.
Safari adds one requirement of its own. MDN notes that when you build your own video controls, Safari only shows subtitle cues if the track has the default attribute.
Syntax
<track kind="captions" src="captions-en.vtt" srclang="en" label="English (CC)" default>
Values
| Value |
|---|
| A boolean attribute: present or absent. |
Example
<video id="v" src="https://codeshack.io/web/example.mp4" controls muted width="240">
<track kind="subtitles" srclang="fr" label="Français" src="data:text/vtt,WEBVTT%0A%0A00:00.000%20--%3E%2000:31.000%0ASous-titres%20en%20fran%C3%A7ais">
<track kind="captions" srclang="en" label="English (CC)" default src="data:text/vtt,WEBVTT%0A%0A00:00.000%20--%3E%2000:31.000%0A(music)%20The%20default%20track%20is%20on">
</video>
<p id="out"></p>
<p><small>Each track inlines its WebVTT text as a data: URL. A real page points src at a .vtt file.</small></p>
<script>
const list = document.getElementById('v').textTracks;
const show = () => {
document.getElementById('out').textContent = [...list].map(t => t.label + ' is ' + t.mode).join(', ');
};
list.addEventListener('change', show);
show();
</script>
Best practices
- Put
defaulton the captions track in the video's main language when the dialogue matters, so viewers who watch with the sound off still get the words. - Use it on only one subtitles or captions track per media element, as the HTML Standard requires.
- Load a metadata track your script depends on by setting its
modetohidden, which fetches the cues without drawing them. - Include
defaulton the first visible track when you build custom controls, since MDN notes Safari needs it to show subtitle cues. - Treat
defaultas a fallback, not a lock. The viewer's caption preferences are checked first, and the player menu still lets viewers switch.
Accessibility
A default captions track shows spoken content to viewers who cannot hear the audio. It also helps anyone watching with the sound off, and it does not override anyone's settings, because the browser checks the viewer's caption preferences before it falls back to the default track.
Frequently asked questions
What does the default attribute do on a track element?
Why are my captions not showing until I pick them from the menu?
Can more than one track have the default attribute?
Does the default attribute override the viewer's caption settings?
How do I turn on a track with JavaScript instead of the default attribute?
video.textTracks[0].mode = 'showing'. The hidden mode loads cues without drawing them, which is what the default attribute does for metadata tracks.






















