MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla

Revision 349103 of window.navigator.language

  • Revision slug: DOM/window.navigator.language
  • Revision title: window.navigator.language
  • Revision id: 349103
  • Created:
  • Creator: Karvjorm
  • Is current revision? Ei
  • Comment

Revision Content

{{ DomRef() }}

Yhteenveto

Palauttaa selaimen kieliversiota edustavan merkkijonon.

Syntaksi

lang = window.navigator.language 

Parametrit

  • kieliversiota edustava lang-merkkijono on määritelty dokumentissa RFC 4646. Kelvollisen kielikoodin esimerkit sisältävät "en", "en-US", "fr", "es-ES", jne.

Esimerkki

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

Selainyhteensopivuus

{{ CompatibilityTable() }}

Ominaisuus Chrome Firefox (Gecko) Internet Explorer Opera Safari
Perustuki

{{ CompatVersionUnknown() }}

Starting in Chrome 0.3.154, this property's value is based on the value of the Accept-Language HTTP header.

{{ CompatGeckoDesktop(1.0) }}

Prior to Gecko 2.0 {{ geckoRelease("2.0") }}, this property's value was also part of the user agent string, as reported by {{ domxref("window.navigator.userAgent", "navigator.userAgent") }}.

Starting in Gecko 5.0 {{ geckoRelease("5.0") }}, this property's value is based on the value of the Accept-Language HTTP header.

{{ CompatNo() }}

Closest available (non-standard) properties are userLanguage and browserLanguage.

{{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}
Ominaisuus Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Perustuki {{ CompatVersionUnknown() }} {{ CompatGeckoMobile(1.0) }}

{{ CompatNo() }}

Closest available (non-standard) properties are userLanguage and browserLanguage.

{{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}

Spesifikaatio

DOM Level 0. Ei ole spesifikaation osa.

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

Revision Source

<p>{{ DomRef() }}</p>
<h3 id="Summary" name="Summary">Yhteenveto</h3>
<p>Palauttaa selaimen kieliversiota edustavan merkkijonon.</p>
<h3 id="Syntax" name="Syntax">Syntaksi</h3>
<pre class="eval">
<em>lang</em> = window.navigator.language 
</pre>
<h3 id="Parameters" name="Parameters">Parametrit</h3>
<ul>
  <li>kieliversiota edustava <code>lang</code>-merkkijono on määritelty dokumentissa <a class="external" href="http://tools.ietf.org/html/rfc4646" title="http://tools.ietf.org/html/rfc4646">RFC 4646</a>. Kelvollisen kielikoodin esimerkit sisältävät "en", "en-US", "fr", "es-ES", jne.</li>
</ul>
<h3 id="Example" name="Example">Esimerkki</h3>
<pre class="brush: js">
if ( window.navigator.language&nbsp;!= "en" ) {       
 doLangSelect(window.navigator.language); 
}
</pre>
<h3 id="Browser_compatibility">Selainyhteensopivuus</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Ominaisuus</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Perustuki</td>
        <td>
          <p>{{ CompatVersionUnknown() }}</p>
          <p><a href="https://code.google.com/p/chromium/issues/detail?id=1862" title="https://code.google.com/p/chromium/issues/detail?id=1862">Starting in Chrome 0.3.154</a>, this property's value is based on the value of the <code>Accept-Language</code> <a href="/en/HTTP/Headers" title="en/HTTP/Headers">HTTP&nbsp;header</a>.</p>
        </td>
        <td>
          <p>{{ CompatGeckoDesktop(1.0) }}</p>
          <p>Prior to Gecko 2.0 {{ geckoRelease("2.0") }}, this property's value was also part of the user agent string, as reported by {{ domxref("window.navigator.userAgent", "navigator.userAgent") }}.</p>
          <p>Starting in Gecko 5.0 {{ geckoRelease("5.0") }}, this property's value is based on the value of the <code>Accept-Language</code> <a href="/en/HTTP/Headers" title="en/HTTP/Headers">HTTP&nbsp;header</a>.</p>
        </td>
        <td>
          <p>{{ CompatNo() }}</p>
          <p>Closest available (non-standard) properties are <a href="http://msdn.microsoft.com/en-us/library/ie/ms534713.aspx" title="http://msdn.microsoft.com/en-us/library/ie/ms534713.aspx">userLanguage</a> and <a href="http://msdn.microsoft.com/en-us/library/ie/ms533542.aspx" title="http://msdn.microsoft.com/en-us/library/ie/ms533542.aspx">browserLanguage</a>.</p>
        </td>
        <td>{{ CompatVersionUnknown() }}</td>
        <td>{{ CompatVersionUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Ominaisuus</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Perustuki</td>
        <td>{{ CompatVersionUnknown() }}</td>
        <td>{{ CompatGeckoMobile(1.0) }}</td>
        <td>
          <p>{{ CompatNo() }}</p>
          <p>Closest available (non-standard) properties are <a href="http://msdn.microsoft.com/en-us/library/ie/ms534713.aspx" title="http://msdn.microsoft.com/en-us/library/ie/ms534713.aspx">userLanguage</a> and <a href="http://msdn.microsoft.com/en-us/library/ie/ms533542.aspx" title="http://msdn.microsoft.com/en-us/library/ie/ms533542.aspx">browserLanguage</a>.</p>
        </td>
        <td>{{ CompatVersionUnknown() }}</td>
        <td>{{ CompatVersionUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h3 id="Specification" name="Specification">Spesifikaatio</h3>
<p>DOM Level 0. Ei ole spesifikaation osa.</p>
<p>{{ languages( { "ja": "ja/DOM/window.navigator.language","zh-cn": "zh-cn/DOM/window.navigator.language", "pl": "pl/DOM/window.navigator.language", "fi": "fi/DOM/window.navigator.language" } ) }}</p>
Revert to this revision