Track srclang Property
Example
Get the language code of the track text data:
var x = document.getElementById("myTrack").srclang;
x The output result is:
en
Definition and Usage
The srclang property is used to set or return the value of the track's srclang attribute.
The srclang property describes the language of the track text data.
If kind="subtitles", this attribute is required.
Tip: You can use Language Code Reference Manual to view more language code variables.
Browser support





Internet Explorer, Opera, and Chrome browsers support the srclang property.
**Note:** Firefox, Safari, or Internet Explorer 9 and earlier IE versions do not support the srclang property.
Syntax
Return the srclang property:
trackObject
.srclang
Set the srclang property:
trackObject
.srclang=
language_code
Attribute values
| Value | Description |
|---|---|
| language_code | Describes the language code (two letters) of the track text data |
Technical Details
| Return Value: | A string representing the language code of the text track data |
|---|
More examples
Example
Modify the language code of the track text data:
document.getElementById("myTrack").srclang="no";
Related pages
HTML Reference Manual: HTML
The Track object