NavigatorLanguage

NavigatorLanguage contains methods and properties related to the language of the navigator.

There is no object of type NavigatorLanguage , but other interfaces, like Navigator or WorkerNavigator , implement it.

特性

NavigatorLanguage interface doesn't inherit any property.

NavigatorLanguage.language 只读
返回 DOMString representing the preferred language of the user, usually the language of the browser UI. The null value is returned when this is unknown.
NavigatorLanguage.languages 只读
Returns an array of DOMString representing the languages known to the user, by order of preference.

方法

NavigatorLanguage interface neither implements, nor inherit any method.

规范

规范 状态 Comment
HTML Living Standard
The definition of 'NavigatorLanguage' in that specification.
实时标准 Since the HTML5 snapshot, the languages property has been added.
HTML5
The definition of 'NavigatorLanguage' in that specification.
Recommendation Initial specification; snapshot of an early version HTML Living Standard .

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
NavigatorLanguage Chrome 1 Edge 12 Firefox 1 IE 11 Opera 4 Safari 1 WebView Android 1 Chrome Android 18 Firefox Android 4 Opera Android 10.1 Safari iOS 1 Samsung Internet Android 1.0
language Chrome 1
1
Returns the browser UI language, not the value of the Accept-Language HTTP header .
Edge 12
12
In Chromium versions of Edge, this returns the browser UI language, not the value of the Accept-Language HTTP header .
Firefox 1
1
Prior to Firefox 4, this property's value was also part of the user agent string, as reported by navigator.userAgent . Starting in Firefox 5, this property's value is based on the value of the Accept-Language HTTP header .
IE 11
11
Closest available (non-standard) properties are userLanguage and browserLanguage .
Opera 4 Safari 1 WebView Android 1
1
Returns the browser UI language, not the value of the Accept-Language HTTP header .
Chrome Android 18
18
Returns the browser UI language, not the value of the Accept-Language HTTP header .
Firefox Android 4 Opera Android 10.1 Safari iOS 1 Samsung Internet Android 1.0
1.0
Returns the browser UI language, not the value of the Accept-Language HTTP header .
languages
Chrome 32
32
In Chrome, navigator.language is the language of the browser UI, and is not guaranteed to be equal to navigator.languages[0] .
Edge 12
12
In Chromium versions of Edge, this returns the browser UI language, not the value of the Accept-Language HTTP header .
Firefox 32
32
In Firefox, the navigator.languages property's value is taken from the intl.accept_languages preference.
IE 11
11
Closest available (non-standard) properties are userLanguage and browserLanguage .
Opera 24 Safari 11 WebView Android 4.4.3
4.4.3
In Chrome, navigator.language is the language of the browser UI, and is not guaranteed to be equal to navigator.languages[0] .
Chrome Android 32
32
In Chrome, navigator.language is the language of the browser UI, and is not guaranteed to be equal to navigator.languages[0] .
Firefox Android 4
4
In Firefox, the navigator.languages property's value is taken from the intl.accept_languages preference.
Opera Android 24 Safari iOS Yes Samsung Internet Android 2.0
2.0
In Samsung Internet, navigator.language is the language of the browser UI, and is not guaranteed to be equal to navigator.languages[0] .
Available in workers Chrome ? Edge ? Firefox 35 IE No Opera ? Safari No WebView Android ? Chrome Android ? Firefox Android 35 Opera Android ? Safari iOS No Samsung Internet Android ?

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
见实现注意事项。

另请参阅

  1. NavigatorLanguage
  2. 特性
    1. language
    2. languages
  3. 实现通过:
    1. Navigator
    2. WorkerNavigator
  4. Related pages for HTML DOM
    1. BeforeUnloadEvent
    2. DOMStringMap
    3. ErrorEvent
    4. GlobalEventHandlers
    5. HTMLAnchorElement
    6. HTMLAreaElement
    7. HTMLAudioElement
    8. HTMLBRElement
    9. HTMLBaseElement
    10. HTMLBaseFontElement
    11. HTMLBodyElement
    12. HTMLButtonElement
    13. HTMLCanvasElement
    14. HTMLContentElement
    15. HTMLDListElement
    16. HTMLDataElement
    17. HTMLDataListElement
    18. HTMLDialogElement
    19. HTMLDivElement
    20. HTMLDocument
    21. HTMLElement
    22. HTMLEmbedElement
    23. HTMLFieldSetElement
    24. HTMLFormControlsCollection
    25. HTMLFormElement
    26. HTMLFrameSetElement
    27. HTMLHRElement
    28. HTMLHeadElement
    29. HTMLHeadingElement
    30. HTMLHtmlElement
    31. HTMLIFrameElement
    32. HTMLImageElement
    33. HTMLInputElement
    34. HTMLIsIndexElement
    35. HTMLKeygenElement
    36. HTMLLIElement
    37. HTMLLabelElement
    38. HTMLLegendElement
    39. HTMLLinkElement
    40. HTMLMapElement
    41. HTMLMediaElement
    42. HTMLMetaElement
    43. HTMLMeterElement
    44. HTMLModElement
    45. HTMLOListElement
    46. HTMLObjectElement
    47. HTMLOptGroupElement
    48. HTMLOptionElement
    49. HTMLOptionsCollection
    50. HTMLOutputElement
    51. HTMLParagraphElement
    52. HTMLParamElement
    53. HTMLPictureElement
    54. HTMLPreElement
    55. HTMLProgressElement
    56. HTMLQuoteElement
    57. HTMLScriptElement
    58. HTMLSelectElement
    59. HTMLShadowElement
    60. HTMLSourceElement
    61. HTMLSpanElement
    62. HTMLStyleElement
    63. HTMLTableCaptionElement
    64. HTMLTableCellElement
    65. HTMLTableColElement
    66. HTMLTableDataCellElement
    67. HTMLTableElement
    68. HTMLTableHeaderCellElement
    69. HTMLTableRowElement
    70. HTMLTableSectionElement
    71. HTMLTemplateElement
    72. HTMLTextAreaElement
    73. HTMLTimeElement
    74. HTMLTitleElement
    75. HTMLTrackElement
    76. HTMLUListElement
    77. HTMLUnknownElement
    78. HTMLVideoElement
    79. HashChangeEvent
    80. History
    81. ImageData
    82. Location
    83. MessageChannel
    84. MessageEvent
    85. MessagePort
    86. Navigator
    87. NavigatorGeolocation
    88. NavigatorID
    89. NavigatorOnLine
    90. NavigatorPlugins
    91. PageTransitionEvent
    92. Plugin
    93. PluginArray
    94. PopStateEvent
    95. PortCollection
    96. PromiseRejectionEvent
    97. RadioNodeList
    98. Transferable
    99. ValidityState
    100. Window
    101. WindowBase64
    102. WindowEventHandlers
    103. WindowTimers