The languagechange
event is fired at the global scope object when the user's preferred language changes.
This event is not cancelable and does not bubble.
The languagechange
event is fired at the global scope object when the user's preferred language changes.
This event is not cancelable and does not bubble.
Use the event name in methods like addEventListener()
, or set an event handler property.
js
addEventListener("languagechange", (event) => {}); onlanguagechange = (event) => {};
A generic Event
.
You can use the languagechange
event in an addEventListener
method:
js
worker.addEventListener("languagechange", () => { console.log("languagechange event detected!"); });
Or use the onlanguagechange
event handler property:
js
worker.onlanguagechange = (event) => { console.log("languagechange event detected!"); };
Specification |
---|
HTML Standard # event-languagechange |
HTML Standard # handler-workerglobalscope-onlanguagechange |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
languagechange_event |
4 | 79 | 74 | No | 11.5 | 4 | ≤37 | 18 | 79 | 14 | 5 | 1.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/languagechange_event