--- title: languagechange slug: Web/API/Window/languagechange_event translation_of: Web/API/Window/languagechange_event ---

{{SeeCompatTable}}

当用户首选语言更改时,将在全局范围对象上触发languagechange事件。

General info

Specification
{{ SpecName('HTML WHATWG', 'indices.html#event-languagechange') }}
Interface
{{domxref("Event")}}
Bubbles
No
Cancelable
No
Target
The default window scope, being {{domxref("Window")}} on Web pages and {{domxref("WorkerGlobalScope")}} in Web Workers.
Default Action
None

Properties

Being of type {{domxref("Event")}}, this event implements the properties of this interface.

{{domxref("Event.target")}} {{ReadonlyInline}}
Returns an {{domxref("EventTarget")}} that is the topmost target in the DOM tree of the event.
{{domxref("Event.type")}} {{ReadonlyInline}}
Returns a {{domxref("DOMString")}} representing the type of event, here "languagechange".
{{domxref("Event.bubbles")}}{{ReadonlyInline}}
Returns a {{domxref("Boolean")}} indicating if the event normally bubbles or not.
{{domxref("Event.cancelable")}}{{ReadonlyInline}}
Returns a {{domxref("Boolean")}} indicating if it is possible to cancel the event.

Specification

Specification Status Comment
{{ SpecName('HTML WHATWG', 'indices.html#event-languagechange', 'languagechange') }} {{ Spec2('HTML WHATWG') }} Initial definition
{{ SpecName('HTML5.1', '#dom-navigator-languages', 'NavigatorLanguage.languages') }} {{ Spec2('HTML5.1') }} Initial definition.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 37 {{ CompatGeckoDesktop("32") }} [1] {{ CompatNo() }} 24 {{ CompatNo() }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatNo() }} {{ CompatGeckoMobile("32") }}[1] {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}

[1]In Firefox, the navigator.languages property's value is taken from the intl.accept_languages preference.

See also