WindowEventHandlers.onlanguagechange
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The onlanguagechange property of the WindowEventHandlers mixin is the event handler for processing languagechange events.
These events are received by the object implementing this interface, usually a Window, an HTMLBodyElement, or an HTMLIFrameElement. Such an event is sent by the browser to inform that the preferred languages list has been updated. The list is accessible via Navigator.languages.
Syntax
object.onlanguagechange = function;
Value
-
functionis 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 typeEvent.
Example
window.onlanguagechange = function(event) { console.log('languagechange event detected!'); };
Specifications
| Specification |
|---|
| HTML Standard (HTML) # handler-window-onlanguagechange |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
onlanguagechange |
37 |
≤79 |
32 |
No |
24 |
10.1 |
37 |
37 |
4 |
24 |
10.3 |
4.0 |
See also
- The
languagechangeevent and its type,Event
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onlanguagechange