Window: languagechange event

The languagechange event is fired at the global scope object when the user's preferred language changes.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

addEventListener('languagechange', event => { });
onlanguagechange = event => { };

Event type

A generic Event.

Event handler aliases

In addition to the Window interface, the event handler property onlanguagechange is also available on the following targets:

Examples

You can use the languagechange event in an addEventListener method:

window.addEventListener('languagechange', function() {
  console.log('languagechange event detected!');
});

Or use the onlanguagechange event handler property:

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

Specifications

Specification
HTML Standard
# event-languagechange
HTML Standard
# handler-window-onlanguagechange

Browser compatibility

BCD tables only load in the browser

See also