The onlanguagechange property of the WorkerGlobalScope interface represents an EventHandler to be called when the languagechange event occurs and bubbles through the Worker.


self.onlanguagechange = function() { ... };


The following code snippet shows an onlanguagechange handler set inside a worker:

self.onlanguagechange = function() {
  console.log('Your preferred language settings have been changed');


Specification Status Comment
HTML Living Standard
The definition of 'WorkerGlobalScope.onlanguagechange' in that specification.
Living Standard

Browser compatibility

BCD tables only load in the browser

See also

The WorkerGlobalScope interface it belongs to.