Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 752961 of WindowEventHandlers.onlanguagechange

  • Revision slug: Web/API/WindowEventHandlers/onlanguagechange
  • Revision title: WindowEventHandlers.onlanguagechange
  • Revision id: 752961
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment Editorial reviewWeb/API/WindowEventHandlers.onlanguagechange Web/API/WindowEventHandlers/onlanguagechange

Revision Content

{{ APIRef() }}{{SeeCompatTable}}

The WindowEventHandlers.onlanguagechange event handler is a property containing the code to execute when the {{event("languagechange")}} event, of type {{domxref("Event")}}, is received by the object implementing this interface, usually a {{domxref("Window")}}, an {{domxref("HTMLBodyElement")}}, or an {{domxref("HTMLIFrameElement")}}. Such an event is sent by the browser to inform that the preferred languages list has been updated. The list is accessible via {{domxref("NavigatorLanguage.languages")}}.

Syntax

object.onlanguagechange = function;

Values

  • function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. An event handler always has one single parameter, containing the event, here of type {{domxref("Event")}}.

Example

navigator.onlanguagechange = function(ev) { alert("languagechange event detected!"); };

Specifications

Specification Status Comment
{{ SpecName('HTML WHATWG', '#handler-workerglobalscope-onlanguagechange', 'WindowEventHandler.onlanguagechange') }} {{ Spec2('HTML WHATWG') }} Initial specification.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{ CompatUnknown() }} {{ CompatGeckoDesktop(32.0) }} {{ CompatNo() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatGeckoMobile(32.0) }} {{ CompatNo() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

  • The {{event("languagechange")}} event and its type, {{domxref("Event")}}.

Revision Source

<p>{{ APIRef() }}{{SeeCompatTable}}</p>

<p>The <code><strong>WindowEventHandlers.onlanguagechange</strong></code> event handler is a property containing the code to execute when the {{event("languagechange")}} event, of type {{domxref("Event")}}, is received by the object implementing this interface, usually a {{domxref("Window")}}, an {{domxref("HTMLBodyElement")}}, or an {{domxref("HTMLIFrameElement")}}. Such an event is sent by the browser to inform that the preferred languages list has been updated. The list is accessible via {{domxref("NavigatorLanguage.languages")}}.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="eval">
<em>object</em>.onlanguagechange = <em>function</em>;
</pre>

<h3 id="Values">Values</h3>

<ul>
 <li><code>function</code> is the name of a user-defined function, without the <code>()</code> suffix or any parameters, or an anonymous function declaration, such as <code>function(event) {...}</code>. An event handler always has one single parameter, containing the event, here of type {{domxref("Event")}}.</li>
</ul>

<h2 id="Example">Example</h2>

<pre class="brush: js">
navigator.onlanguagechange = function(ev) { alert("languagechange event detected!"); };
</pre>

<h2 id="Specifications" name="Specifications">Specifications</h2>

<table class="standard-table" height="49" width="1000">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{ SpecName('HTML WHATWG', '#handler-workerglobalscope-onlanguagechange', 'WindowEventHandler.onlanguagechange') }}</td>
   <td>{{ Spec2('HTML WHATWG') }}</td>
   <td>Initial specification.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatGeckoDesktop(32.0) }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatGeckoMobile(32.0) }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>The {{event("languagechange")}} event and its type, {{domxref("Event")}}.</li>
</ul>
Revert to this revision