{{ 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")}}, a {{domxref("HTMLBodyElement")}} or a {{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 asfunction(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")}}.