Track srclangProperty
Example
Get the language code of the track text data:
var x = document.getElementById("myTrack").srclang;
xThe 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 attribute describes the language of the track text data.
If kind="subtitles", this attribute is required.
Tip:You can check theLanguage Code Reference Manualto see more language code variables.
Browser Support
![]()
![]()
![]()
![]()
![]()
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 srclang property:
trackObject.srclang
Set the srclang property:
trackObject.srclang=language_code
Property Values
| Value | Description |
|---|---|
| language_code | Describes the language code of the track text data (two letters) |
Technical Details
| Return Value: | A string representing the language code of the track text data |
|---|
More Examples
Example
Change the language code of the track text data:
document.getElementById("myTrack").srclang="no";
Related Pages
HTML Reference Manual:HTML <track> srclang Attribute
Track Object Other Extensions