--- title: NavigatorLanguage.language slug: orphaned/Web/API/NavigatorLanguage/language translation_of: Web/API/NavigatorLanguage/language original_slug: Web/API/NavigatorLanguage/language ---
{{APIRef("HTML DOM")}}

 

NavigatorLanguage.language 읽기 전용 속성은 사용자의 기본 언어 (일반적으로 브라우저 UI의 언어)를 나타내는 문자열을 반환합니다.

Syntax

var lang = navigator.language

Value

A {{domxref("DOMString")}}. lang stores a string representing the language version as defined in BCP 47. Examples of valid language codes include "en", "en-US", "fr", "fr-FR", "es-ES", etc.

Note that in Safari on macOS and iOS prior to 10.2, the country code returned is lowercase: "en-us", "fr-fr" etc.

Example

if (window.navigator.language != 'en') {
  doLangSelect(window.navigator.language);
}

Specifications

Specification Status Comment
{{ SpecName('HTML5.1', '#dom-navigator-language', 'NavigatorLanguage.language') }} {{ Spec2('HTML5.1') }} Initial definition

Browser compatibility

{{Compat("api.NavigatorLanguage.language")}}

See also