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 NavigatorLanguage.languages.

Syntax

object.onlanguagechange = function;

Value

  • 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 Event.

Example

window.onlanguagechange = function(event) {
  console.log('languagechange event detected!');
};

Specifications

Specification
HTML Standard (HTML)
# handler-window-onlanguagechange

Browser compatibility

BCD tables only load in the browser

See also