A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/lang below:

HTMLElement: lang property - Web APIs

HTMLElement: lang property

Baseline Widely available

The lang property of the HTMLElement interface indicates the base language of an element's attribute values and text content, in the form of a RFC 5646: BCP 47 language identifier tag. It reflects the element's lang attribute; the xml:lang attribute does not affect this property.

Note that if the lang attribute is unspecified, the element itself may still inherit the language from its parent. However, that inherited language is not reflected by this property's value.

Value

A string. Common examples include "en" for English, "ja" for Japanese, "es" for Spanish and so on. If unspecified, the value is an empty string.

Examples
// this snippet compares the base language and
// redirects to another URL based on language
if (document.documentElement.lang === "en") {
  window.location.href = "Some_document.html.en";
} else if (document.documentElement.lang === "ru") {
  window.location.href = "Some_document.html.ru";
}
Specifications Browser compatibility

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3