我需要使用javascript检测操作系统语言,以便可以根据语言查看我的页面.
I need to detect OS language using javascript so I can view my page depending on the language.
我知道我们可以检测到浏览器语言,但这对我来说还不够.
I know that we can detect the browser language but that is not enough for me.
我需要操作系统语言
预先感谢
推荐答案没有跨浏览器的方法. Internet Explorer支持以下内容:
There is no cross-browser way to do this. Internet Explorer supports the following:
- navigator.browserLanguage:浏览器语言
- navigator.systemLanguage:Windows系统语言
- navigator.userLanguage:Windows用户特定语言
- navigator.browserLanguage: browser language
- navigator.systemLanguage: Windows system language
- navigator.userLanguage: Windows user-specific language
但是无法从其他任何浏览器访问这些设置(据我所知),所以不要使用它们:坚持使用标准navigator.language(与浏览器语言相对应)如果要维护跨浏览器功能.如果您确实使用它们,则会将您的网站绑定到特定的操作系统家族(例如Windows)和特定的浏览器(例如Internet Explorer).您真的要这样做吗?
But there is no way to access these settings from any other browsers (that I can tell) so don't use them: stick to the standard navigator.language (corresponding to the browser language) if you want to maintain cross-browser functionality. If you do use them you will tie your web site to a specific family of operating systems (i.e. Windows) and a specific browser (i.e. Internet Explorer). Do you really want to do this?
为什么浏览器语言不足以支持您的应用?
Why is the browser language insufficient for your application?
更多推荐
无论如何,有使用JavaScript检测OS语言的方法吗?
发布评论