Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Window
  4. languagechange

Window: languagechange event

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨January 2020⁩.

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

Syntax

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

js
addEventListener("languagechange", (event) => { })onlanguagechange = (event) => { }

Event type

A genericEvent.

Event handler aliases

In addition to theWindow interface, the event handler propertyonlanguagechange is also available on the following targets:

Examples

You can use thelanguagechange event in anaddEventListener method:

js
window.addEventListener("languagechange", () => {  console.log("languagechange event detected!");});

Or use theonlanguagechange event handler property:

js
window.onlanguagechange = (event) => {  console.log("languagechange event detected!");};

Specifications

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

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp