Track srclang Attribute

Definition and Usage

srclang The attribute sets or returns the value of the srclang attribute of the track.

The HTML srclang attribute specifies the language of the track text data.

If kind="subtitles", this attribute is required.

Tip:To view all available language codes, please visit ourLanguage Code Reference Manual.

See also:

HTML Reference Manual:HTML <track> srclang Attribute

Instance

Example 1

Get the language code of the track text data:

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

The result of x may be:

en

Example 2

Change the language code of the track text data:

document.getElementById("myTrack").srclang = "no";

Syntax

Return the srclang attribute:

trackObject.srclang

Set the srclang attribute:

trackObject.srclang = language_code

Attribute Value

Value Description
language_code Specifies a two-letter language code to specify the language of the track text data.

Technical Details

Return Value: A string value representing the language code for text track data.

Browser Support

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