Track srclang
Attribute
Example
Retrieve the language code of the track text data:
var x = document.getElementById("myTrack").srclang;
x output result:
en
Definition and Usage
The srclang
attribute is used to set or return the value of the srclang
attribute of a track.
The srclang
attribute describes the language of the track text data.
This attribute is mandatory if kind="subtitles"
.
Tip: You can refer to the Language Codes Reference for more language code variables.
Browser Support
Internet Explorer, Opera, and Chrome support the srclang
attribute.
Note: Firefox, Safari, or Internet Explorer 9 and earlier versions do not support the srclang
attribute.
Syntax
Return the srclang
attribute:
Set the srclang
attribute:
Attribute Values
Value | Description |
---|---|
language_code | Describes the language code (two letters) of the track text data |
Technical Details
| Return Value: | 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: HTML <track>
srclang Attribute