Movatterモバイル変換


[0]ホーム

URL:


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

WorkerGlobalScope: languagechange event

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Note: This feature is only available inWeb Workers.

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

This event is not cancelable and does not bubble.

Syntax

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

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

Event type

A genericEvent.

Examples

You can use thelanguagechange event in anaddEventListener method:

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

Or use theonlanguagechange event handler property:

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

Specifications

Specification
HTML
# event-languagechange
HTML
# handler-workerglobalscope-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