navigator.language

  • Revision slug: DOM/window.navigator.language
  • Revision title: window.navigator.language
  • Revision id: 34004
  • Created:
  • Creator: Skierpage
  • Is current revision? No
  • Comment language gone from navigator.userAgent in FF 4 (using templates from [[User_Agent_Strings_Reference]]); 17 words added, 2 words removed

Revision Content

{{ DomRef() }}

Summary

Returns a string representing the language version of the browser.

Syntax

lang = window.navigator.language 

Parameters

  • lang string representing the language version as defined in RFC 4646. Examples of valid language codes include "en", "en-US", "fr", "es-ES", etc.

Example

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

Notes

Prior to {{ geckoRelease("2.0") }}, this property also showed up as part of the navigator.userAgent string . {{ obsolete_inline("2.0") }}

Specification

DOM Level 0. Not part of specification.

{{ languages( { "ja": "ja/DOM/window.navigator.language", "pl": "pl/DOM/window.navigator.language" } ) }}

Revision Source

<p>
{{ DomRef() }}
</p>
<h3 name="Summary">Summary</h3>
<p>Returns a string representing the language version of the browser. </p>
<h3 name="Syntax">Syntax </h3>
<pre class="eval"><i>lang</i> = window.navigator.language 
</pre>
<h3 name="Parameters">Parameters </h3>
<ul><li><code>lang</code> string representing the language version as defined in <a class="external" href="http://tools.ietf.org/html/rfc4646" title="http://tools.ietf.org/html/rfc4646">RFC 4646</a>. Examples of valid language codes include "en", "en-US", "fr", "es-ES", etc.
</li></ul>
<h3 name="Example">Example </h3>
<pre>if ( window.navigator.language != "en" ) {       
 doLangSelect(window.navigator.language); 
}
</pre>
<h3 name="Notes">Notes</h3>
<p>Prior to <em>{{ geckoRelease("2.0") }}</em>, this property also showed up as part of the <a href="/en/DOM/window.navigator.userAgent" title="en/DOM/window.navigator.userAgent">navigator.userAgent</a> string . {{ obsolete_inline("2.0") }}</p><h3 name="Specification">Specification </h3>
<p>DOM Level 0. Not part of specification.
</p>
<div class="noinclude">
</div>
{{ languages( { "ja": "ja/DOM/window.navigator.language", "pl": "pl/DOM/window.navigator.language" } ) }}
Revert to this revision